What should be the HttpClient lifetime of a WebAPI client?
Is it better to have one instance of the HttpClient for multiple calls?
Wh
You may also want to refer to this blog post by Simon Timms: https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/
But
HttpClientis different. Although it implements theIDisposableinterface it is actually a shared object. This means that under the covers it is reentrant) and thread safe. Instead of creating a new instance ofHttpClientfor each execution you should share a single instance ofHttpClientfor the entire lifetime of the application. Let’s look at why.