c# - 无法加载文件或程序集 'System.Net.Http' 或其依赖项之一

标签 c# .net azure

也许相关信息:我有一个使用 .net 4.5 构建的 Web 应用程序。我想部署到 Azure 的网站,但它只支持 .net 4.0,因此我将项目降级到 .net 4.0。 在本地运行时它仍然有效。

当我发布到 Azure 时,出现此错误:

Could not load file or assembly 'System.Net.Http' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

我已经尝试使用 nuget 删除 Web API 并阅读它,正如 SO 上的另一个问题所建议的那样,但我仍然遇到同样的问题。
我尝试过关闭/打开 VS,以及清理/构建。

最佳答案

我解决了类似的问题(System.Web.Http 和 System.Net.Http.Formatting)错误,方法是删除对问题引用的引用(指向我的 .Net 安装文件夹)并将其替换为中的引用文件我的包文件夹,由 Microsoft.AspNet.WebApi NuGet 包安装。

关于c# - 无法加载文件或程序集 'System.Net.Http' 或其依赖项之一,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12238179/

相关文章:

c# - 我的上网IP是多少

c# - 递归枚举图

c# - 计算有多少项目出现在具有特定 ID 的项目之前

python - 可以在 Azure HDInsight 中使用 Hadoop Streaming API 运行 python 代码吗?

c# - Web Api 和 Web ui 在同一应用程序/服务中

c# 将数据从 datagridview 保存到 Mysql 时出错

c# - AsReadOnly 是否返回集合的副本?

c# - ASP.NET 信号R : How to get the group name of particular caller?

c# - Image.FromFile 为什么读取位图比读取 jpeg 文件快

sql - 如何使用azure数据工厂拆分列值