网页API:System.Net.Http版本2.0.0.0未找到 [英] Web Api: System.Net.Http version 2.0.0.0 not found

查看:1734
本文介绍了网页API:System.Net.Http版本2.0.0.0未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我安装的NuGet包的WebAPI,它给我的System.Net.Http版本1.0.0.0,但它引用版本2。

When I install the NuGet package for WebApi, it gives me version 1.0.0.0 of System.Net.Http, yet it references version 2.

我似乎无法找到版本2我的生活。当我下载.NET 4.5,我得到System.Net.Http版本4.0.315.x,但我不能使用,因为网页API组件是指2.0.0.0版本。

I cannot seem to find version 2 for the life of me. When I download .net 4.5 I get System.Net.Http version 4.0.315.x, but I cannot use that because the Web Api assemblies refer to version 2.0.0.0.

任何人都知道在哪里可以找到这个版本2.0.0.0?我已经试过的NuGet包管理器,mvc4,.NET 4.5,并没有什么给我2版。

Anyone know where I can find this version 2.0.0.0? I've tried the NuGet package manager, mvc4, .net 4.5, and nothing is giving me version 2.

先谢谢了。

推荐答案

下添加您的Web.config文件中的配置如下<假设节点(;&System.Web程序GT您的应用程序在.NET 4.5中运行, targetFramework 属性设置为4.5):

Add the below configuration inside your Web.config file under <system.web> node (assuming your app runs on .NET 4.5, targetFramework attribute is set to 4.5):

<compilation targetFramework="4.5">
  <assemblies>
    <add assembly="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </assemblies>
</compilation>

还要添加下面的一个在根级别下的&LT;结构&gt; 节点:

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" />
      <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>

这应该解决您的问题。

这篇关于网页API:System.Net.Http版本2.0.0.0未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆