This page is about the Microsoft.Net.Http package. Our first release announcement can be found here.
When installing HttpClient into a project that contains an app.config or web.config with binding redirects, the config file may be incorrectly transformed. EG: <dependentAssembly bcl:name="System.Net.Http"> <assemblyIdentity name="ExistingAssembly" publicKeyToken="abcdef012345678" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-2.0.43.0" newVersion="2.0.43.0" /> </dependentAssembly>
To fix this you can update the config as follows: <dependentAssembly> <assemblyIdentity name="ExistingAssembly" publicKeyToken="abcdef012345678" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> <dependentAssembly bcl:name="System.Net.Http"> <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-2.0.43.0" newVersion="2.0.43.0" /> </dependentAssembly>
When using HttpClient from a Silverlight application the FormUrlEncodedContent and MultipartContent classes incorrectly encode content using UTF8 instead of iso-8859-1.
At the moment we recommend avoiding use of these classes from a Silverlight application until he issue is fixed.
When using HttpClient from a Silverlight application many http headers are not supported and will result in an ArgumentException or NotImplementedException when set and calling HttpClient methods that send a request.
For a list of headers which are not supported in Silverlight please see: http://msdn.microsoft.com/en-us/library/system.net.webheadercollection(v=vs.95).aspxhttp://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.headers(v=vs.95).aspx
When HttpClientHandler.SupportsProtocolVersion() is false the HttpResponseMessage returned from a request will have a null value for Version.
Make sure that anytime you are using a version from the HttpResponseMessage, you do a null check on it if SupportsProtocolVersion() is false.
When using consuming HttpClient in an .Net 4.0, 4.5, or Windows Store application by referencing portable library project the wrong version of HttpClient is selected for the platform.
To avoid this always install the HttpClient Nuget package in every project that consumes the library (even indirectly).
When using HttpClient on Silverlight or the Phone be aware that the networking stack may cache responses.
Resolution
To avoid inconsistencies when creating portable class library that runs on both platforms be sure that your server sets the cache control-header on the response to match your expected caching behavior on the Phone. If you do not control the server, consider making a portion of the request unique if you do not want a cached result.
When consuming a portable class library using HttpClient from a .NET 4.5, Windows Store or Windows Phone 8 application, the application crashes with an exception similar to this:
Method not found: 'Void System.Net.Http.HttpClientHandler.set_AutomaticDecompression(System.Net.DecompressionMethods)'.
The application project needs to reference the HttpClient NuGet package as well.
ClickOnce applications targeting .NET Framework 4.0 that reference the Microsoft.Net.Http package may experience a TypeLoadException or other errors after being installed.
This occurs because ClickOnce fails to deploy certain required assemblies. As a workaround, do the following: