asp.net – 无法加载文件或程序集“System.Web.Mvc,Version = 3.0.0.0,Elmah.
发布时间:2020-05-23 07:53:18 所属栏目:asp.Net 来源:互联网
导读:本地 – 我的MVC 4,asp.net,c#应用程序运行良好在IIS 8 / Windows 8。 当部署到Windows Server 2008时,我收到此错误: Could not load file or assembly System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
|
本地 – 我的MVC 4,asp.net,c#应用程序运行良好在IIS 8 / Windows 8。 当部署到Windows Server 2008时,我收到此错误: Could not load file or assembly 'System.Web.Mvc,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 和 [FileLoadException: Could not load file or assembly 'System.Web.Mvc,PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)] Elmah.Mvc.Bootstrap.Initialize() +0 [InvalidOperationException: The pre-application start initialization method Initialize on type Elmah.Mvc.Bootstrap threw an exception with the following error message: Could not load file or assembly 'System.Web.Mvc,PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).] System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods,Func`1 setHostingEnvironmentCultures) +12881963 System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +12881672 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +240 System.Web.Compilation.BuildManager.ExecutePreAppStart() +152 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParameters hostingParameters,PolicyLevel policyLevel,Exception appDomainCreationException) +1151 [HttpException (0x80004005): The pre-application start initialization method Initialize on type Elmah.Mvc.Bootstrap threw an exception with the following error message: Could not load file or assembly 'System.Web.Mvc,PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12881108 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext context) +12722297 如果我从项目属性/包/发布web中的“要部署的项目”下拉列表中选择“只需要运行此应用程序的文件”,就会发生这种情况。 如果我选择“这个项目中的所有文件”,它工作正常。 我猜Elmah是依赖于一个旧版本的MVC或东西 – 我该如何解决这个问题,而不必上传所有的文件? 什么是解决这种情况的最佳方式? 谢谢。 解决方法我有这个完全相同的问题使用MVC4与Ninject为.Net 4.5要解决这个问题,我不得不添加一个绑定重定向到我的Web.config文件: <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
这将强制Web服务器使用System.Web.Mvc 4.0.0.0而不是旧版本。 (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- ASP.Net,C#.Net和VB.Net之间的区别?
- asp.net – page load()或者page init()
- asp.net – 我可以在SQL会话状态配置中重用现有连接字符串吗
- asp.net-mvc – Razor View语法无法识别HTML属性中的“@”
- 为什么我不能在我的代码asp.net c#中使用app_code中的代码文
- asp.net – FindControl()返回null
- asp.net-mvc – 如何将MVC 5 IdentityModels.cs移动到单独的
- asp.net-mvc – 路由是在我的区域中找到控制器,但不是视图
- asp.net – 如何更改FileUpload控件(System.Web.UI.WebCont
- asp.net – 在.net 3.5 SP1中设置表单的操作会在编译时导致
推荐文章
站长推荐
热点阅读
