Skip to content

Is HttpClientFactory the safer option? #203

Answered by canton7
NickLydon asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by NickLydon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants