{"id":178413,"date":"2013-04-30T04:10:03","date_gmt":"2013-04-30T00:10:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=178413"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=178413","title":{"rendered":"<span class=\"post_title\">HttpClient \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 Windows Phone<\/span>"},"content":{"rendered":"<div class=\"content html_format\">       <i>\u041e\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430:<br \/>  \u042d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u0431\u043b\u043e\u0433\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 BCL, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0442\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u044b. \u0421\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043f\u043e\u0441\u0442\u0430.<\/i><\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f (<i>18 \u0444\u0435\u0432\u0440\u0430\u043b\u044f 2013 \u0433. \u2014 \u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430<\/i>) \u043c\u044b \u0430\u043d\u043e\u043d\u0441\u0438\u0440\u0443\u0435\u043c \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u044e <a href=\"https:\/\/nuget.org\/packages\/Microsoft.Net.Http\">\u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 HttpClient<\/a>, \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e API \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0442\u044c\u044e. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 HttpClient \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0431\u043e\u0440\u043e\u043c API \u0434\u043b\u044f .NET, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u0433\u0438\u0431\u043a\u0438\u0439 \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c HTTP.<\/p>\n<p>  \u042d\u0442\u043e\u0442 \u0432\u044b\u043f\u0443\u0441\u043a \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 HttpClient \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c:  <\/p>\n<ul>\n<li>.NET Framework 4.0<\/li>\n<li>Windows Phone 7.5 \u0438 \u0432\u044b\u0448\u0435<\/li>\n<li>\u041f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/li>\n<\/ul>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 HttpClient?<\/h4>\n<p>  HttpClient \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 .NET Framework 4.5 \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 Windows Store \u0438 \u0434\u0430\u0451\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043a \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c, \u0432\u043a\u043b\u044e\u0447\u0430\u044f REST-\u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u041f\u043e \u0441\u0443\u0442\u0438, \u043c\u0435\u0442\u043e\u0434\u044b HttpClient \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u0451\u0440\u0442\u043a\u0430\u043c\u0438 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 HTTP-\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a GET\/PUT\/POST\/DELETE.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0441 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"http:\/\/www.contoso.com\">www.contoso.com<\/a>, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"cs\">HttpClient httpClient = new HttpClient(); string responseBodyAsText = await httpClient.GetStringAsync(\u201cwww.contoso.com\u201d); <\/code><\/pre>\n<p>  \u2026 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 HttpClient \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<h4>\u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u0435\u043d \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0439 HttpClient?<\/h4>\n<p>  \u0414\u043e \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430, \u043a\u043b\u0430\u0441\u0441 HttpClient \u043d\u0435 \u0431\u044b\u043b \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445. \u042d\u0442\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u043b\u043e \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c, \u043f\u044b\u0442\u0430\u0432\u0448\u0438\u043c\u0441\u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u044c \u043a\u043e\u0434 \u043c\u0435\u0436\u0434\u0443 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u043c\u0438 Microsoft. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u043e\u0442\u0435\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u0434\u043b\u044f Windows Phone, \u0438 \u0434\u043b\u044f Windows Store, \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0442\u044c\u044e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 HttpWebRequest \u0438 HttpWebResponse, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445. \u041e\u0434\u043d\u0430\u043a\u043e HttpClient \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c, \u0438 \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043e\u043d \u0431\u043b\u0438\u0436\u0435 \u043a \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0435 HTTP, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u0435\u043d. \u0412\u0434\u043e\u0431\u0430\u0432\u043e\u043a HttpClient \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u044b\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 Task&#8217;\u0430\u0445, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0435\u0433\u0447\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0442\u0437\u044b\u0432\u0447\u0438\u0432\u044b\u0439 \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 UI \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0431\u0435\u043b, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0434\u043b\u044f HttpClient, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c HttpClient \u043d\u0430 Windows Phone 7.5 \u0438 \u0432\u044b\u0448\u0435, \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 Windows Store, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432 .NET Framework 4.0 \u0438 \u0432\u044b\u0448\u0435. \u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u0434\u0430\u0441\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0438\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c HttpClient \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0442\u044c\u044e.<\/p>\n<h4>\u0427\u0442\u043e \u043c\u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f?<\/h4>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u044d\u0442\u0438\u043c \u0432\u044b\u043f\u0443\u0441\u043a\u043e\u043c HttpClient, \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0432\u0435 \u0432\u0435\u0449\u0438:  <\/p>\n<ul>\n<li>Visual Studio 2010 (\u0434\u043b\u044f .NET 4.0 \u0438 Windows Phone 7.1) \u0438\u043b\u0438 Visual Studio 2012 (\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0434\u043b\u044f .NET 4.5, Windows Store \u0438 Windows Phone 8).<\/li>\n<li>\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 NuGet \u0432\u0435\u0440\u0441\u0438\u0438 2.1 \u0438\u043b\u0438 \u0432\u044b\u0448\u0435.<\/li>\n<\/ul>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 HttpClient, \u0449\u0451\u043b\u043a\u043d\u0438\u0442\u0435 \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u043c\u044b\u0448\u0438 \u043d\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0438, \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0443\u043d\u043a\u0442 \u00ab\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438 Nuget\u00bb (Manage Nuget Packages), \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443 \u00abMicrosoft.Net.Http\u00bb \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u044b\u0431\u0440\u0430\u043d \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u00ab\u0412\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438\u00bb (Include Prerelease).<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/410\/7dd\/b4e\/4107ddb4e2f83308c4cff5e51a82616f.png\"\/><br \/>  \u041f\u0440\u0438\u043c\u0438\u0442\u0435 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435, \u0438 NuGet \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0432 \u043f\u0430\u043f\u043a\u0443.<\/p>\n<h4>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h4>\n<p>  \u041f\u043e\u043b\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0434\u043b\u044f HttpClient, \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 .NET Framework 4.5, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/hh193681(v=vs.110)\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u042d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u044b\u0445 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e. \u042d\u0442\u0438 \u043d\u043e\u0432\u044b\u0435 API \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0442\u044c\u044e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0435 \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445. \u041d\u043e\u0432\u044b\u043c\u0438 API \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f:<\/p>\n<pre><code class=\"cs\">public static bool SupportsPreAuthenticate(this HttpClientHandler handler); public static bool SupportsProtocolVersion(this HttpClientHandler handler); public static bool SupportsTransferEncodingChunked(this HttpClientHandler handler); <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445, \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u043d\u044c\u0448\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">HttpMessageHandler handler = new HttpClientHandler(); httpClient = new HttpClient(handler); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, resourceAddress); request.Content = streamContent; request.Headers.TransferEncodingChunked = true;  HttpResponseMessage response = await httpClient.SendAsync(request); <\/code><\/pre>\n<p>  \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0435\u0441\u0442\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434:<\/p>\n<pre><code class=\"cs\">HttpMessageHandler handler = new HttpClientHandler(); httpClient = new HttpClient(handler); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, resourceAddress); request.Content = streamContent; if (handler.SupportsTransferEncodingChunked()) {    request.Headers.TransferEncodingChunked = true;  } HttpResponseMessage response = await httpClient.SendAsync(request); <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 HttpClient \u0432 .NET Framework 4.0 \u0438\u043b\u0438 Windows Phone 7.5<\/h4>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0438\u0448\u0435\u0442\u0435 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f .NET 4.0 \u0438\u043b\u0438 Windows Phone \u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u0442\u0435 \u043a\u043e\u0434, \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435, \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438: \u201cCannot await System.Threading.Task\u201d.<\/p>\n<p>  \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e .NET 4.0 \u0438 Windows Phone 7.5 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 async\/await. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 NuGet-\u043f\u0430\u043a\u0435\u0442 Microsoft.Bcl.Async, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 Async \u0438 Await \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c. \u0423\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u0430\u043a\u0435\u0442\u0435 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"http:\/\/habrahabr.ru\/post\/178101\/\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <a href=\"http:\/\/visualstudio.uservoice.com\/forums\/121579-visual-studio\/suggestions\/3158400-add-httpclient-in-portable-class-library-pcl-?tracking_code=02eea86a2711ee54158af1caf8ff21a1\"><img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/f23\/3ab\/825\/f233ab82544868c5b2fa3e9f3b36a3f8.png\"\/><\/a><\/p>\n<p>  \u042d\u0442\u043e \u0431\u044b\u043b\u043e \u043e\u0434\u043d\u043e \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 UserVoice, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0442\u043e, \u0447\u0442\u043e \u0443\u0434\u0435\u043b\u0438\u043b\u0438 \u044d\u0442\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u044f. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442 \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u0440\u0435\u043b\u0438\u0437\u043d\u044b\u0439, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0432 \u043d\u0451\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u00ab\u0448\u0435\u0440\u043e\u0445\u043e\u0432\u0430\u0442\u043e\u0441\u0442\u0435\u0439\u00bb. \u041c\u044b \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c (<i>\u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u0443 \u2014 \u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430<\/i>). \u0418 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u043d\u0430\u043c \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0443\u0437\u043d\u0430\u0442\u044c, \u0441 \u043a\u0430\u043a\u0438\u043c\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c\u0438 \u0432\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430.<\/p>\n<h4>\u0418\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h4>\n<p>  <\/p>\n<h5>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 1<\/h5>\n<p>  <\/p>\n<h6>\u0421\u0438\u043c\u043f\u0442\u043e\u043c<\/h6>\n<p>\u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 HttpClient \u0432 \u043f\u0440\u043e\u0435\u043a\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 app.config \u0438\u043b\u0438 web.config \u0441 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u043e\u043a, config-\u0444\u0430\u0439\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0451\u043d. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"xml\">&lt;dependentAssembly bcl:name=&quot;System.Net.Http&quot;&gt;   &lt;assemblyIdentity name=&quot;ExistingAssembly&quot; publicKeyToken=&quot;abcdef012345678&quot; culture=&quot;neutral&quot; \/&gt;   &lt;bindingRedirect oldVersion=&quot;0.0.0.0-2.0.0.0&quot; newVersion=&quot;2.0.0.0&quot; \/&gt;   &lt;assemblyIdentity name=&quot;System.Net.Http&quot; publicKeyToken=&quot;b03f5f7f11d50a3a&quot; culture=&quot;neutral&quot; \/&gt;   &lt;bindingRedirect oldVersion=&quot;0.0.0.0-2.0.43.0&quot; newVersion=&quot;2.0.43.0&quot; \/&gt; &lt;\/dependentAssembly&gt; <\/code><\/pre>\n<p>  <\/p>\n<h6>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h6>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c config-\u0444\u0430\u0439\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"xml\">&lt;dependentAssembly&gt;   &lt;assemblyIdentity name=&quot;ExistingAssembly&quot; publicKeyToken=&quot;abcdef012345678&quot; culture=&quot;neutral&quot; \/&gt;   &lt;bindingRedirect oldVersion=&quot;0.0.0.0-2.0.0.0&quot; newVersion=&quot;2.0.0.0&quot; \/&gt; &lt;\/dependentAssembly&gt; &lt;dependentAssembly bcl:name=&quot;System.Net.Http&quot;&gt;   &lt;assemblyIdentity name=&quot;System.Net.Http&quot; publicKeyToken=&quot;b03f5f7f11d50a3a&quot; culture=&quot;neutral&quot; \/&gt;   &lt;bindingRedirect oldVersion=&quot;0.0.0.0-2.0.43.0&quot; newVersion=&quot;2.0.43.0&quot; \/&gt; &lt;\/dependentAssembly&gt; <\/code><\/pre>\n<p>  <\/p>\n<h5>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 2<\/h5>\n<p>  <\/p>\n<h6>\u0421\u0438\u043c\u043f\u0442\u043e\u043c<\/h6>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 HttpClient \u0432 Silverlight-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u044b FormUrlEncodedContent \u0438 MultipartContent \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043a\u043e\u0434\u0438\u0440\u0443\u044e\u0442 \u043a\u043e\u043d\u0442\u0435\u043d\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f UTF8 \u0432\u043c\u0435\u0441\u0442\u043e ISO-8859-1.<\/p>\n<h6>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h6>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u0432\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 Silverlight-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u043f\u043e\u043a\u0430 \u044d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430.<\/p>\n<h5>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 3<\/h5>\n<p>  <\/p>\n<h6>\u0421\u0438\u043c\u043f\u0442\u043e\u043c<\/h6>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 HttpClient \u0432 Silverlight-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043c\u043d\u043e\u0433\u0438\u0435 HTTP-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f, \u0438 \u0435\u0441\u043b\u0438 \u0438\u0445 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 HttpClient, \u043f\u043e\u0441\u044b\u043b\u0430\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f ArgumentException \u0438\u043b\u0438 NotImplementedException.<\/p>\n<h6>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h6>\n<p>\u0421\u043c. \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0432 Silverlight \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432:<br \/>  <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.net.webheadercollection(v=vs.95).aspx\">http:\/\/msdn.microsoft.com\/en-us\/library\/system.net.webheadercollection(v=vs.95).aspx<\/a><br \/>  <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.net.httpwebrequest.headers(v=vs.95).aspx\">http:\/\/msdn.microsoft.com\/en-us\/library\/system.net.httpwebrequest.headers(v=vs.95).aspx<\/a><\/p>\n<h5>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 4<\/h5>\n<p>  <\/p>\n<h6>\u0421\u0438\u043c\u043f\u0442\u043e\u043c<\/h6>\n<p>\u041a\u043e\u0433\u0434\u0430 HttpClientHandler.SupportsProtocolVersion() \u0440\u0430\u0432\u043d\u043e false, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e Version \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 HttpResponseMessage \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 null.<\/p>\n<h6>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h6>\n<p>\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 Version \u0438\u0437 HttpResponseMessage \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u0435\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 null, \u0435\u0441\u043b\u0438 SupportsProtocolVersion() \u0440\u0430\u0432\u043d\u043e false.<\/p>\n<h5>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 5<\/h5>\n<p>  <\/p>\n<h6>\u0421\u0438\u043c\u043f\u0442\u043e\u043c<\/h6>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e HttpClient \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 .NET 4.0, 4.5 \u0438\u043b\u0438 Windows Store \u043f\u0443\u0442\u0451\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f HttpClient \u0434\u043b\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b.<\/p>\n<h6>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h6>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e, \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0439\u0442\u0435 NuGet-\u043f\u0430\u043a\u0435\u0442 HttpClient \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 (\u0434\u0430\u0436\u0435 \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u043e).<\/p>\n<h5>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 6<\/h5>\n<p>  <\/p>\n<h6>\u0421\u0438\u043c\u043f\u0442\u043e\u043c<\/h6>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 HttpClient \u0432 Silverlight \u0438\u043b\u0438 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0439\u0442\u0435 \u0432\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0441\u0442\u0435\u043a \u043c\u043e\u0436\u0435\u0442 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<h6>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h6>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0439 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0439 \u043d\u0430 \u043e\u0431\u0435\u0438\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430\u0434\u0430\u0451\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a Cache-Control \u0432 \u043e\u0442\u0432\u0435\u0442\u0435, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u0442\u0435 \u0441\u0435\u0440\u0432\u0435\u0440, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<h5>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 7<\/h5>\n<p>  <\/p>\n<h6>\u0421\u0438\u043c\u043f\u0442\u043e\u043c<\/h6>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0439 HttpClient, \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 .NET 4.5, Windows Store \u0438\u043b\u0438 Windows Phone 8, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0430\u0432\u0430\u0440\u0438\u0439\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c, \u043f\u043e\u0445\u043e\u0436\u0438\u043c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<br \/>  <code>\u041c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d: 'Void System.Net.Http.HttpClientHandler.set_AutomaticDecompression(System.Net.DecompressionMethods)'.<\/code><\/p>\n<h6>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h6>\n<p>\u0412 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 Nuget-\u043f\u0430\u043a\u0435\u0442 HttpClient.<\/p>\n<h4>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438<\/h4>\n<p>  <\/p>\n<ul>\n<li><a href=\"http:\/\/blogs.msdn.com\/b\/bclteam\/archive\/2013\/02\/18\/portable-httpclient-for-net-framework-and-windows-phone.aspx\">Portable HttpClient for .NET Framework and Windows Phone<\/a><\/li>\n<li>\u0418\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u2014 <a href=\"http:\/\/blogs.msdn.com\/b\/bclteam\/p\/httpclient.aspx\">http:\/\/blogs.msdn.com\/b\/bclteam\/p\/httpclient.aspx<\/a><\/li>\n<\/ul>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/178413\/\"> http:\/\/habrahabr.ru\/post\/178413\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">       <i>\u041e\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430:<br \/>  \u042d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u0431\u043b\u043e\u0433\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 BCL, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0442\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u044b. \u0421\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043f\u043e\u0441\u0442\u0430.<\/i><\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f (<i>18 \u0444\u0435\u0432\u0440\u0430\u043b\u044f 2013 \u0433. \u2014 \u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430<\/i>) \u043c\u044b \u0430\u043d\u043e\u043d\u0441\u0438\u0440\u0443\u0435\u043c \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u044e <a href=\"https:\/\/nuget.org\/packages\/Microsoft.Net.Http\">\u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 HttpClient<\/a>, \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e API \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0442\u044c\u044e. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 HttpClient \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0431\u043e\u0440\u043e\u043c API \u0434\u043b\u044f .NET, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u0433\u0438\u0431\u043a\u0438\u0439 \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c HTTP.<\/p>\n<p>  \u042d\u0442\u043e\u0442 \u0432\u044b\u043f\u0443\u0441\u043a \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 HttpClient \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c:  <\/p>\n<ul>\n<li>.NET Framework 4.0<\/li>\n<li>Windows Phone 7.5 \u0438 \u0432\u044b\u0448\u0435<\/li>\n<li>\u041f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/li>\n<\/ul>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-178413","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/178413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=178413"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/178413\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=178413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=178413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=178413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}