ASP.NET Web表单在运行时抛出MVC依赖性错误

时间:2013-08-09 16:50:34

标签: asp.net windows asp.net-mvc-3 runtime-error .net-framework-version

我有一个很小的ASP.NET网络应用程序,可以在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)

2 个答案:

答案 0 :(得分:0)

您是否在您的网站上部署System.Web.Mvc,或者您是否依赖于开发计算机上的GAC复制?您可以将此博文发布到bin deploy mvc3 to a server,也可以使用web platform installer在目标服务器上安装mvc3。

如果已经安装了MVC3,并且您需要查看有关绑定错误的更多详细信息,则可以在目标计算机上enable the fusion log

答案 1 :(得分:0)

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

尝试在system.web - >下插入此行。编译 - >组件

<remove assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>