为什么我的MVC Web应用程序抛出了CultureNotFoundException? [英] Why is my MVC web app throwing a CultureNotFoundException?

查看:98
本文介绍了为什么我的MVC Web应用程序抛出了CultureNotFoundException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我正在运行一个MVC网络应用程序,我在启动应用程序时遇到了一些奇怪的错误。它们不一致 - 每次错误看起来都不一样 - 但是一致的是我的应用程序无法正常运行。



这些错误开始发生重启我的机器后。没有安装Windows更新,虽然有一些更新可以下载和安装。



我正在运行Windows 7并在VS 2015中进行开发。 />


以下是我得到的一些常见错误的一些例子:



1)这一个在尝试访问网站时发生:



发生System.Globalization.CultureNotFoundException

消息:抛出异常:'System.Globalization.CultureNotFoundException'在mscorlib.dll中$
附加信息:不支持文化。



2)这个在尝试点击几个边后发生菜单项(没有响应):
$


发生System.Web.HttpException
$
消息:抛出异常:'System.Web。 System.Web.dll中的HttpException'
附加信息:文件监视的文件名无效:'C:\ Users \gshah \ Source \ Repos \RiskAlive \ Web \\features\Projects’。失败的常见原因包括:

- 文件名不是有效的Win32文件名。

- 文件名不是绝对路径。

- 文件名包含通配符。

- 指定的文件是目录。

- 拒绝访问。



3)试图访问网站时发生:
$
在DefaultRegistry.cs的这一行发生:



        public DefaultRegistry(){

           扫描(
$
         scan => {

       ;     scan.AssembliesFromApplicationBaseDirectory(

            a => a.FullName .StartsWith(" ACM"));

           scan.WithDefaultConventions();

scan.With(new ControllerConvention());

         });

        }


发生了System.IO.FileNotFoundException

  FileName = Microsoft.Build.Tasks.CodeAnalysis

  FusionLog ====预绑定状态信息===

LOG:DisplayName = Microsoft.Build.Tasks.CodeAnalysis

 (Partial)

WRN:为程序集提供了部分绑定信息:
$
WRN:程序集名称:Microsoft.Build.Tasks.CodeAnalysis |域ID:2

WRN:仅提供部分程序集显示名称时发生部分绑定。

WRN:这可能导致绑定程序加载错误的程序集。

WRN:建议为程序集提供完全指定的文本标识,

WRN:包含简单名称,版本,文化和公钥标记。

WRN:有关此问题的更多信息和常见解决方案,请参阅白皮书http://go.microsoft.com/fwlink/?LinkId=109270。

日志:Appbase = file:/// C:/ Users / gshah / Source / Repos / RiskAlive / Web /

LOG:Initial PrivatePath = C:\ Users\gshah\Source\Repos\RiskAlive \ Web\bin

调用程序集:StructureMap.Net4,Version = 4.0.1.318,Culture = neutral,PublicKeyToken = null。

===

日志:此绑定在默认加载上下文中启动。

日志:使用应用程序配置文件:C:\ Users \gshah\Source\Repos \RiskAlive \ Web \\ _web.config

日志:使用主机配置文件:C:\ Users \gshah \ Document \ IISExpress\config\aspnet.config

LOG :使用C:\ Windows \ Macrooft.NET \ Framework \v4.0.30319 \ config \machine.config中的计算机配置文件。

日志:政策未应用于参考这次(私有,自定义,部分或基于位置的程序集绑定)。

日志:尝试下载新的URL文件:/// C:/Windows/Microsoft.NET/Framework/v4。 0.30319 / Temporary ASP.NET Files / vs / b1cac612 / 3c296358 / Microsoft.Build.Tasks.CodeAnalysis.DLL。

日志:尝试下载新的URL文件:/// C:/ Windows / Microsoft .NET / Framework / v4.0.30319 / Temporary ASP.NET Files / vs / b1cac612 / 3c296358 / Microsoft.Build.Tasks.CodeAnalysis / Microsoft.Build.Tasks.CodeAnalysis.DLL。

日志:尝试下载新的URL文件:/// C:/Users/gshah/Source/Repos/RiskAlive/Web/bin/Microsoft.Build.Tasks.CodeAnalysis.DLL。

日志:尝试做wnload的新URL文件:/// C:/Users/gshah/Source/Repos/RiskAlive/Web/bin/Microsoft.Build.Tasks.CodeAnalysis/Microsoft.Build.Tasks.CodeAnalysis.DLL。

日志:尝试下载新的URL文件:/// C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files / vs / b1cac612 / 3c296358 /Microsoft.Build.Tasks.CodeAnalysis.EXE 。

日志:尝试下载新的URL文件:/// C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files / vs / b1cac612 / 3c296358 / Microsoft。 Build.Tasks.CodeAnalysis /Microsoft.Build.Tasks.CodeAnalysis.EXE。

日志:尝试下载新的URL文件:/// C:/ Users / gshah / Source / Repos / RiskAlive / Web /bin/Microsoft.Build.Tasks.CodeAnalysis.EXE。

日志:尝试下载新的URL文件:/// C:/ Users / gshah / Source / Repos / RiskAlive / Web / bin / Microsoft.Build.Tasks.CodeAnalysis / Microsoft.Build.Tasks.CodeAnalysis.EXE。



  HResult = -2147024894

  Message =无法加载文件或程序集"Microsoft.Build.Tasks.CodeAnalysis"或其依赖项之一。系统找不到指定的文件。

 来源= mscorlib

  StackTrace:

       在System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean
forIntrospection,Boolean suppressSecurityChecks)

       在System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean
forIntrospection,Boolean suppressSecurityChecks)

  InnerException:
$


最重要的是,我的一些CSS没有被加载。



我发现这篇在线文章准确解释了我对CultureNotFoundException的问题,但它没有提供解决方案:



https://edd.stefancamilleri.com / 2013/11/25 / asp-net-mvc-always-throws-a-system-globalization-culture -notnotfoundexception /



关于可能发生的事情的任何想法?



谢谢。

解决方案

我正在运行MVC网络应用程序


http:// forums .asp.net / 1146.aspx / 1?MVC


Hello,

I'm running an MVC web application and I'm getting some weird errors upon starting the application. They aren't consistent--the errors seem different every time--but what is consistent is that my application just won't run properly.

These errors started happening after rebooting my machine. No Windows updates were installed, although there are some updates that are ready to be downloaded and installed.

I'm running Windows 7 and developing in VS 2015.

Here are some examples of some of the more common errors I'm getting:

1) This one happens upon trying to hit the website:

System.Globalization.CultureNotFoundException occurred
Message: Exception thrown: 'System.Globalization.CultureNotFoundException' in mscorlib.dll
Additional information: Culture is not supported.

2) This one happens after trying to click a few of the side menu items (which didn't respond):

System.Web.HttpException occurred
Message: Exception thrown: 'System.Web.HttpException' in System.Web.dll
Additional information: Invalid file name for file monitoring: 'C:\Users\gshah\Source\Repos\RiskAlive\Web\features\Projects'. Common reasons for failure include:
- The filename is not a valid Win32 file name.
- The filename is not an absolute path.
- The filename contains wildcard characters.
- The file specified is a directory.
- Access denied.

3) Happened upon trying to hit the website:
Happened at this line in DefaultRegistry.cs:

        public DefaultRegistry() {
            Scan(
                scan => {
                    scan.AssembliesFromApplicationBaseDirectory(
                     a => a.FullName.StartsWith("ACM"));
                    scan.WithDefaultConventions();
scan.With(new ControllerConvention());
                });
        }

System.IO.FileNotFoundException occurred
  FileName=Microsoft.Build.Tasks.CodeAnalysis
  FusionLog==== Pre-bind state information ===
LOG: DisplayName = Microsoft.Build.Tasks.CodeAnalysis
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Microsoft.Build.Tasks.CodeAnalysis | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/gshah/Source/Repos/RiskAlive/Web/
LOG: Initial PrivatePath = C:\Users\gshah\Source\Repos\RiskAlive\Web\bin
Calling assembly : StructureMap.Net4, Version=4.0.1.318, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\gshah\Source\Repos\RiskAlive\Web\web.config
LOG: Using host configuration file: C:\Users\gshah\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/b1cac612/3c296358/Microsoft.Build.Tasks.CodeAnalysis.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/b1cac612/3c296358/Microsoft.Build.Tasks.CodeAnalysis/Microsoft.Build.Tasks.CodeAnalysis.DLL.
LOG: Attempting download of new URL file:///C:/Users/gshah/Source/Repos/RiskAlive/Web/bin/Microsoft.Build.Tasks.CodeAnalysis.DLL.
LOG: Attempting download of new URL file:///C:/Users/gshah/Source/Repos/RiskAlive/Web/bin/Microsoft.Build.Tasks.CodeAnalysis/Microsoft.Build.Tasks.CodeAnalysis.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/b1cac612/3c296358/Microsoft.Build.Tasks.CodeAnalysis.EXE.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/b1cac612/3c296358/Microsoft.Build.Tasks.CodeAnalysis/Microsoft.Build.Tasks.CodeAnalysis.EXE.
LOG: Attempting download of new URL file:///C:/Users/gshah/Source/Repos/RiskAlive/Web/bin/Microsoft.Build.Tasks.CodeAnalysis.EXE.
LOG: Attempting download of new URL file:///C:/Users/gshah/Source/Repos/RiskAlive/Web/bin/Microsoft.Build.Tasks.CodeAnalysis/Microsoft.Build.Tasks.CodeAnalysis.EXE.

  HResult=-2147024894
  Message=Could not load file or assembly 'Microsoft.Build.Tasks.CodeAnalysis' or one of its dependencies. The system cannot find the file specified.
  Source=mscorlib
  StackTrace:
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
  InnerException:

On top of that, some of my CSS is not being loaded.

I found this article online which explains exactly the problem I'm having with the CultureNotFoundException, but it doesn't offer a solution:

https://edd.stefancamilleri.com/2013/11/25/asp-net-mvc-always-throws-a-system-globalization-culturenotfoundexception/

Any ideas as to what might be happening?

Thanks.

解决方案

I'm running an MVC web application

http://forums.asp.net/1146.aspx/1?MVC


这篇关于为什么我的MVC Web应用程序抛出了CultureNotFoundException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆