[英]Azure failing Could not load file or assembly 'System.Net.Http, Version=4.2.0.0
我已经有一段时间了这个错误。
奇怪的是,只有在将应用程序发布到Azure时,才出现此错误,这很好。
我已经将重定向更改为:
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.1.1.0" />
</dependentAssembly>
我在网上看过,很幸运。
它本身就是一个使用框架4.7.2的Umbraco网站
任何帮助将是巨大的!
更新-我将System.Net.Http作为对我的Web项目的引用,并将本地副本设置为true,这意味着DLL已发布,但现在我得到了错误:
我尝试添加以下内容:
<add assembly="System.Web.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
我也尝试过这样:
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
希望能有所帮助
解决此问题的方法应该很容易:在您的web.config
找到compile \\ assemblies部分,并在System.Net.Http
下添加System.Web.Http
程序集:
<add assembly="System.Web.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
另一件事,也许会有帮助,如果你得到错误编译代码,尝试引用System.Web.Http
4.2版本,并设置生成操作 复制到本地 。
有关更多详细信息,请参阅本文 。
我设法通过删除对System.Http.Net的所有引用,从NuGet卸载它,删除DLL形式((c:\\ Program Files(x86)\\ Microsoft Visual Studio \\ 2017 \\ Enterprise \\ MSBuild \\ Microsoft \\ Microsoft。 NET.Build.Extensions \\ net461 \\ LIB)
然后,我通过NuGet再次安装了它,但安装了最新版本,并从web.config中删除了所有其他绑定重定向。
然后,此问题得以解决。
谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.