首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >无法从HRESULT加载文件或程序集异常: 0x80131040

无法从HRESULT加载文件或程序集异常: 0x80131040
EN

Stack Overflow用户
提问于 2014-02-24 04:27:59
回答 8查看 127.8K关注 0票数 26

我创建了我的第一个MVC4项目,它在本地服务器上工作得很好。但当我将其发布到本地文件夹并将文件夹内容上传到托管服务器时。我尝试运行它,但得到以下错误:

无法加载文件或程序集“DotNetOpenAuth.Core,Version=4.0.0.0,Culture=neutral,PublicKeyToken=2780ccd10d57b246”或其依赖项之一。系统找不到指定的文件。有谁能帮帮我吗?

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>

P.S Web窗体中的同一项目在宿主服务器上工作。

EN

回答 8

Stack Overflow用户

回答已采纳

发布于 2014-02-26 05:54:33

终于找到答案了!转到引用-->在导致问题的dll文件上右键勾选-->选择属性-->检查版本-->将属性中的版本与web配置匹配

<dependentAssembly>
    <assemblyIdentity name="YourDllFile" publicKeyToken="2780ccd10d57b246"               culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-YourDllFileVersion" newVersion="YourDllFileVersion" />
  </dependentAssembly>
票数 64
EN

Stack Overflow用户

发布于 2016-05-19 23:41:11

对我来说立即起作用的是:

  • 我找到了bin文件夹(如下图所示)。为了安全起见,
  • 移动了其他文件夹中的所有dll。然后
  • 重新构建了项目。
  • 解决此问题后,删除了旧的dll文件。

票数 8
EN

Stack Overflow用户

发布于 2016-04-13 19:11:51

如果您的解决方案包含两个相互交互的项目,并且两个项目都使用一个相同的引用,并且两个项目中各自引用的版本不同,则也会发生此类错误。不断更新所有引用到最新的引用。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21974076

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档