От: | _Raz_ | ||
Дата: | 08.11.15 23:44 | ||
Оценка: |
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.
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.