Информация об изменениях

Сообщение Re[3]: WPF + WebClient + async = непонятная кривота от 08.11.2015 23:44

Изменено 09.11.2015 2:00 _Raz_

Здравствуйте, Sinix, Вы писали:

S> решение стандартное находится


Там тоже не все гладко: HttpClient Lifecycle

The HttpClient object is intended to live for as long as your application needs to make HTTP requests. Having an object exist across multiple requests enables a place for setting DefaultRequestHeaders and prevents you from having to respecify things like CredentialCache and CookieContainer on every request, as was necessary with HttpWebRequest.

... << RSDN@Home (RF) 1.2.0 alpha 5 rev. 78>>
Re[3]: WPF + WebClient + async = непонятная кривота
Здравствуйте, Sinix, Вы писали:

S> решение стандартное находится


Там тоже не все гладко: HttpClient Lifecycle

The HttpClient object is intended to live for as long as your application needs to make HTTP requests. Having an object exist across multiple requests enables a place for setting DefaultRequestHeaders and prevents you from having to respecify things like CredentialCache and CookieContainer on every request, as was necessary with HttpWebRequest.


upd:
Henrik F. Nielsen (one of HttpClient's principal Architects): (via)

Everytime you create a new HttpClient you start a new session meaning that new TCP connections will have to get created etc.

In genral I would recommend reusing HttpClient instances as much as possible.

... << RSDN@Home (RF) 1.2.0 alpha 5 rev. 78>>