admin管理员组文章数量:1644425
文章目录
- 问题
- 解决
问题
系统开发完进行生产环境测试时出现错误:
英文版:
Could not load file or assembly ‘System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
中文版:
未能加载文件或程序集“System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)
解决
在 Microsoft Visual Studio 中双击打开System.Net.Http.dll
,再双击打开1 [非特定语言]
:
在启动项目的web.config
或app.config
中添加以下配置
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
完整结构:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
这里使用了 版本重定向
拓展阅读:
- 解决办法:Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Logging
- How the Runtime Locates Assemblies | Microsoft Docs
- c# - Could not load file or assembly 'System.Net.Http - Stack Overflow
本文标签: SystemNETassemblyloadfile
版权声明:本文标题:【已解决】Could not load file or assembly ‘System.Net.Http, Version=xxx, Culture=neutral... 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1729375383a1198777.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论