79086834

Date: 2024-10-14 15:50:00
Score: 1
Natty:
Report link

If your client is injected as transient to a singleton class instance it effectively becomes a singleton itself, which can lead to some issues as well, this is nicely described here: https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/http/httpclient-guidelines#dns-behavior

I think this is what you should be using according to Microsoft: https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/http/httpclient-guidelines#pooled-connections

Good practise is to also set BaseAddress for your Httpclient, that probably applies for your use case as well.

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Robert