1

我有一个很小的 ​​ASP.NET Web 应用程序,它在 Windows 7 上运行良好,但在 Windows 2008 R2 上运行失败并出现此错误。我无法解决为什么我会看到 MVC 依赖项错误。
使用 .NET 4/VS 2010。

    Exception information: 
    Exception type: ConfigurationErrorsException 
    Exception message: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
   at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
   at System.Web.Configuration.AssemblyInfo.get_AssemblyInternal()
   at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
   at System.Web.Compilation.BuildManager.CallPreStartInitMethods()
   at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)`enter code here`
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
4

2 回答 2

0

您是在您的站点上部署 System.Web.Mvc,还是在您的开发机器上依赖 GAC 的副本?您可以按照这篇博文将 mvc3 二进制部署到服务器,也可以使用web 平台安装程序在目标服务器上安装 mvc3 。

如果已经安装了 MVC3,并且您需要查看有关绑定错误的更多详细信息,则可以在目标机器上 启用融合日志。

于 2013-08-09T16:58:12.160 回答
0

这很可能是由子应用程序配置文件继承引起的。父配置文件引用了子应用程序没有的库。

尝试在 system.web --> 编译 --> 程序集下插入这一行

<remove assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
于 2013-08-09T17:42:31.297 回答