Skip to content

Configuring a services HttpClient per tenant #561

Discussion options

You must be logged in to vote

Hi, the best method I've found it to use your own Options class with whatever settings you need in combination with a custom HttpClientHandler implementation which makes use of your Options class.

Info on HttpClientHandler:
https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler?view=net-6.0

I would register it as a transient and then register HttpClient with a factory method that instantiates the HttpClient with the HttpClientHandler. I hope this is helpful.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by chihabhajji
Comment options

You must be logged in to vote
0 replies
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