Do HttpClient and HttpClientHandler have to be disposed between requests?

前端 未结 12 1960
鱼传尺愫
鱼传尺愫 2020-11-22 02:06

System.Net.Http.HttpClient and System.Net.Http.HttpClientHandler in .NET Framework 4.5 implement IDisposable (via System.Net.Http.HttpMessageInvoker).

The usin

12条回答
  •  礼貌的吻别
    2020-11-22 02:06

    Please take a read on my answer to a very similar question posted below. It should be clear that you should treat HttpClient instances as singletons and re-used across requests.

    What is the overhead of creating a new HttpClient per call in a WebAPI client?

提交回复
热议问题