gpt4 book ai didi

asp.net - 无法在 IIS 上加载文件或程序集“System.Net.Http,版本=4.2.0.0,文化=中性”

转载 作者:行者123 更新时间:2023-12-03 17:03:04 30 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





Strange issue with System.Net.Http 4.2.0.0 not found

(24 个回答)


1年前关闭。




我开始更新一些 nuget 包,并开始在构建时收到这些警告,这些警告与 System.Net.Http 冲突。正如这里所建议的:

Strange issue with System.Net.Http 4.2.0.0 not found

我替换了对 System.Net.Http 的所有引用以使用 nuget 版本,而不是与 Visual Studio 捆绑的版本。然后,我按照各处的建议更改了所有重定向绑定(bind)(app.configs 和 web.configs),并让事情在本地工作。但..

当我部署到我们的测试服务器时,我仍然收到错误

Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, 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)

我正在使用 net 4.7.0 和 Visual Studio 2017

我在所有配置中搜索了对 4.2.0.0 版本的引用,但没有命中。为什么 IIS 认为它需要这个?

我的 System.Net.Http 的 nuget 版本是 4.3.4 但实际的 web.config 有这些行
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.1.3" newVersion="4.1.1.3"/>
</dependentAssembly>

我再次可以在本地构建和运行它,但我的服务器报告错误。

更新:我尝试在我的服务器 web.config 上添加它
 <dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.1.1.3" />
</dependentAssembly>

这使错误消失了!但我仍然不明白为什么我需要这样做?比如为什么我的服务器认为它需要使用 4.2.0?

最佳答案

我将我的解决方案更新为 .NET Framework 4.7.2,并确保服务器已安装此版本。这解决了我的问题。之后,我可以删除绑定(bind)重定向。

关于asp.net - 无法在 IIS 上加载文件或程序集“System.Net.Http,版本=4.2.0.0,文化=中性”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55576205/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com