比较程序集名称会导致不匹配:修订版号 [英] Comparing the assembly name resulted in the mismatch: Revision Number

查看:212
本文介绍了比较程序集名称会导致不匹配:修订版号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ASP.NET MVC4应用程序,该应用程序在我的本地计算机上可以正常运行,但在应用程序服务器上不起作用,并引发以下错误:

I am working on ASP.NET MVC4 app which works fine on my local machine but doesn't work on the application server and throws the following error:

无法加载文件或程序集'System.Web.Mvc,Version = 2.0.0.0,文化=中性,PublicKeyToken = 31bf3856ad364e35'或其中之一依赖关系.找到的程序集的清单定义不匹配程序集参考.(来自HRESULT的异常:0x80131040)

Could not load file or assembly 'System.Web.Mvc, Version=2.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)

网络配置:

<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 时,我得到了几乎类似的错误:

When I change the version of System.Web.Mvc to exect version i.e. 4.0.40804.0 I got almost the similar error:

<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.日志:目前未将策略应用于引用(私有,自定义,部分或基于位置的程序集绑定).日志:尝试下载新网址文件:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/TemporaryASP.NET文件/root/f56977f7/c98ce4c8/System.Web.Mvc.DLL.日志:尝试下载新的URL文件:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/TemporaryASP.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.日志:政策后参考:System.Web.Mvc,版本= 4.0.40804.0,文化=中性,PublicKeyToken = 31bf3856ad364e35日志:尝试下载新的URL文件:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/TemporaryASP.NET文件/root/f56977f7/c98ce4c8/System.Web.Mvc.DLL.日志:尝试下载新的URL文件:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/TemporaryASP.NET文件/root/f56977f7/c98ce4c8/System.Web.Mvc/System.Web.Mvc.DLL.日志:尝试下载新的URL文件:///D:/RHDHV_Websites/Graafgebiedinformatie/bin/System.Web.Mvc.DLL.WRN:比较程序集名称会导致不匹配:修订编号ERR:无法完成装配的设置(hr = 0x80131040).探测终止.

LOG: This bind starts in default load context. LOG: Using application configuration file: D:\mywebapp\web.config LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\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/Framework64/v4.0.30319/Temporary ASP.NET Files/root/f56977f7/c98ce4c8/System.Web.Mvc.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/f56977f7/c98ce4c8/System.Web.Mvc/System.Web.Mvc.DLL. LOG: Attempting download of new URL file:///D:/RHDHV_Websites/Graafgebiedinformatie/bin/System.Web.Mvc.DLL. LOG: Using application configuration file: D:\mywebapp\web.config LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Redirect found in application configuration file: 4.0.0.1 redirected to 4.0.40804.0. LOG: Post-policy reference: System.Web.Mvc, Version=4.0.40804.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/f56977f7/c98ce4c8/System.Web.Mvc.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/f56977f7/c98ce4c8/System.Web.Mvc/System.Web.Mvc.DLL. LOG: Attempting download of new URL file:///D:/RHDHV_Websites/Graafgebiedinformatie/bin/System.Web.Mvc.DLL. WRN: Comparing the assembly name resulted in the mismatch: Revision Number ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

任何帮助或提示都将不胜感激.谢谢

Any help or tip is much appreciated. Thank you

推荐答案

我将尝试使用某种消除方法:

I'd try to use some kind of elimination process:

还原绑定重定向

  1. 确保两个环境(本地和远程)上的Web配置都相同
  2. 清洁+构建您的项目.进入bin环境,获取所有dll,并将其粘贴到部署文件夹中.检查其中是否包含System.Web.Mvc.dll.
  3. 确保在您的MVC项目的引用"中引用了mvc dll.

远射.将绑定重定向更改为

Longshot. Change the binding redirect to

      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
      </dependentAssembly>
      <dependentAssembly>

您也可以尝试在远程服务器上安装与您的计算机相同的.net版本,但是如果一切都部署得很好,那就没关系了.

You can also try to install the same .net verstion on the remote server as your machine has, though if all is deoployed well it should not matter.

第二个日志很有意义.它只是根本找不到要加载的任何dll,因此这不是错配.

The second log makes sense. It just doesn't find any dlls at all to load, so it's not a missmatch.

这篇关于比较程序集名称会导致不匹配:修订版号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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