我對JSON開發相當陌生,剛入門是一項非常重要的任務,很少有通過Google解決方案。在VS 2012項目中啓用System.Net.Http
我不能沒有增加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編譯期間拋出了一個錯誤的一部分取得任何進展。下面是我的嘗試:通過
- 重新安裝.NET 4.0
- 重新安裝.NET 4.5
- 重新包裝庫。的NuGet
- 引用system.net
沒有運氣。我甚至試過引用的類在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無法使用的情況下,我沒有引用或做錯。
我可以拍我自己。習慣於直接輕鬆地引用該庫,我忘記直接映射它。像魅力一樣工作。然而HttpWebClient,FormURLEncodedContent,StreamReader和KeyValuePair(雖然是heirachy的一部分)拋出一個錯誤:「期望的類或...」 – Nanohurtz