[英]Enabling System.Net.Http within VS 2012 Project
我对JSON开发还很陌生,刚刚入门是一项重要任务,只有很少的解决方案来自谷歌。
如果不在我的项目中添加system.net.http,我无法到达任何地方
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Net.Http;
var,HttpWebClient,KeyValuePair等对象在编译期间抛出错误。 这是我试过的:
没运气。 我甚至尝试在web.config中引用该类
<compilation targetFramework="4.5">
<assemblies>
<add assembly="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</assemblies>
</compilation>
再次在..
<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>
“程序集”上引发错误
我的智慧结束了。 在无法使用System.Net.Http的情况下,我没有引用或做错。
在.NET 4.5中,System.Net.Http在它自己的程序集中,你必须转到“添加引用”(右键单击项目)并选择它。
请参阅HttpClient的MSDN页面: http : //msdn.microsoft.com/en-us/library/system.net.http.httpclient.aspx
程序集:System.Net.Http(在System.Net.Http.dll中)
帮助系统显示System.Net.Http命名空间在System.Net.Http.dll中定义,如您所说,未列出。 快速搜索我自己的文件系统会显示副本
在我的系统上,这些路径是
C:\Windows\Microsoft.NET\Framework\v4.0.30319
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
System.Net.Http.WebRequest.dll位于相同的路径上。
你试过了吗
using System.Net.Http;
C#是一种区分大小写的语言。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.