【发布时间】:2020-01-25 06:43:38
【问题描述】:
我正在开发 ASP.NET MVC4 应用程序,该应用程序在我的本地计算机上运行良好,但在应用程序服务器上无法运行并引发以下错误:
无法加载文件或程序集'System.Web.Mvc,版本=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 或其之一 依赖关系。定位程序集的清单定义不 匹配程序集引用。 (HRESULT 异常:0x80131040)
网络配置:
<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="0.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="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
当我将 System.Web.Mvc 的版本更改为执行版本时,即 4.0.40804.0 我得到了几乎类似的错误:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.40804.0" newVersion="4.0.40804.0" />
</dependentAssembly>
LOG:此绑定在默认加载上下文中开始。日志:使用应用程序 配置文件:D:\mywebapp\web.config 日志:使用主机 配置文件: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config 日志: 使用来自的机器配置文件 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config。 日志:此时未将策略应用于参考(私人, 自定义、部分或基于位置的程序集绑定)。日志:尝试 下载新网址 file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET 文件/root/f56977f7/c98ce4c8/System.Web.Mvc.DLL。日志: 正在尝试下载新 URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET 文件/root/f56977f7/c98ce4c8/System.Web.Mvc/System.Web.Mvc.DLL。日志: 正在尝试下载新 URL 文件:///D:/RHDHV_Websites/Graafgebiedinformatie/bin/System.Web.Mvc.DLL。 日志:使用应用程序配置文件:D:\mywebapp\web.config 日志: 使用主机配置文件: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config 日志: 使用来自的机器配置文件 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config。 日志:在应用程序配置文件中找到重定向:4.0.0.1 重定向到 4.0.40804.0。 LOG:后策略参考:System.Web.Mvc, 版本=4.0.40804.0,文化=中性,PublicKeyToken=31bf3856ad364e35 日志:尝试下载新 URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET 文件/root/f56977f7/c98ce4c8/System.Web.Mvc.DLL。日志: 正在尝试下载新 URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET 文件/root/f56977f7/c98ce4c8/System.Web.Mvc/System.Web.Mvc.DLL。日志: 正在尝试下载新 URL 文件:///D:/RHDHV_Websites/Graafgebiedinformatie/bin/System.Web.Mvc.DLL。 警告:比较程序集名称导致不匹配:修订 编号 ERR:无法完成程序集的设置 (hr = 0x80131040)。 探测终止。
非常感谢任何帮助或提示。谢谢
【问题讨论】:
标签: c# asp.net .net asp.net-mvc