asp.net – 无法从HRESULT加载文件或程序集异常:0x80131040

前端之家收集整理的这篇文章主要介绍了asp.net – 无法从HRESULT加载文件或程序集异常:0x80131040前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我创建了我的第一个MVC 4项目,它在本地服务器上完美地工作.但是当我发布到本地文件夹并将文件内容上传到托管服务器时.我尝试运行它,我得到这个错误

Could not load file or assembly ‘DotNetOpenAuth.Core,Version=4.0.0.0,Culture=neutral,PublicKeyToken=2780ccd10d57b246’ or one of its dependencies. The system cannot find the file specified.
Can any one help me please?

Web.config文件

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
    <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" />
    <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
  </dependentAssembly>
  <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="WebGrease" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
  </dependentAssembly>
</assemblyBinding>

Web窗体中的同一个项目适用于托管服务器.

解决方法

终于找到答案了!
转到参考文献 – >对dll文件造成问题的正确的cilck – >选择属性 – >检查版本 – >将属性中的版本与Web配置匹配
<dependentAssembly>
    <assemblyIdentity name="YourDllFile" publicKeyToken="2780ccd10d57b246"               culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-YourDllFileVersion" newVersion="YourDllFileVersion" />
  </dependentAssembly>

猜你在找的asp.Net相关文章