C# 比较程序集名称导致不匹配:修订号

C# 比较程序集名称导致不匹配:修订号,c#,asp.net,.net,asp.net-mvc,C#,Asp.net,.net,Asp.net Mvc,我正在使用ASP.NET MVC4应用程序,该应用程序在本地计算机上运行良好,但在应用程序服务器上不工作,并引发以下错误: 无法加载文件或程序集'System.Web.Mvc,版本=2.0.0.0, 区域性=中性,PublicKeyToken=31bf3856ad364e35'或其 依赖关系。定位程序集的清单定义不正确 匹配程序集引用。(来自HRESULT的异常:0x8013100) 网络配置: <assemblyBinding xmlns="urn:schemas-microsoft-c

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

无法加载文件或程序集'System.Web.Mvc,版本=2.0.0.0, 区域性=中性,PublicKeyToken=31bf3856ad364e35'或其 依赖关系。定位程序集的清单定义不正确 匹配程序集引用。(来自HRESULT的异常:0x8013100)

网络配置:

<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的版本更改为exect版本,即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>

日志:此绑定在默认加载上下文中启动。日志:使用应用程序 配置文件: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 file:///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 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 file:///D:/RHDHV_Websites/Graafgebiedinformatie/bin/System.Web.Mvc.DLL. 警告:比较程序集名称导致不匹配:修订 数字错误:未能完成程序集的设置(hr=0x8013100)。 调查结束了


非常感谢任何帮助或提示。谢谢

我会尝试使用某种消除过程:

恢复绑定重定向

  • 确保两个环境(本地和远程)上的web配置相同
  • 清理并构建您的项目。访问bin环境,获取所有DLL并将它们粘贴到部署文件夹中。检查System.Web.Mvc.dll是否在这些文件中
  • 确保mvc项目的引用中引用了mvc dll
  • 朗肖。将绑定重定向更改为

          <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版本,不过如果所有这些都部署得很好,那就不重要了


    第二个日志是有意义的。它根本找不到要加载的DLL,因此它不是一个错误匹配。

    我确实按照建议更改了版本,并按预期工作。谢谢你,让你明白为什么。我注意到它加载在第二个日志中,这很可能意味着4.0.0.0不在机器上,因此重定向失败:)。很高兴我能帮忙。