-
There were previously two issues with creating and disposing HttpClient directly - recognising DNS changes and socket exhaustion.
Thanks for your help, and apologies if this has already been answered. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
My understanding is that I don't think there's any strong need to use HttpClientFactory therefore, although it does tie nicely in with the rest of that infrastructure (e.g. chaining in order HttpMessageHandlers, Polly, etc etc) which means it makes sense to use it if it's available. |
Beta Was this translation helpful? Give feedback.
My understanding is that
SocketsHttpClientHandler
, introduced in .NET Core 2.1, basically fixes all of those issues, so it doesn't matter whether you create lots of new HttpClients, or cache a single one.I don't think there's any strong need to use HttpClientFactory therefore, although it does tie nicely in with the rest of that infrastructure (e.g. chaining in order HttpMessageHandlers, Polly, etc etc) which means it makes sense to use it if it's available.