Which Version of MSAL are you using ?
4.11
Platform
net45, netcore
Affects confidential clients
Repro
- Do not provide a custom IHttpFactory
- Many threads AcquireToken (e.g. web site at scale)
Expected behavior
MSAL should work
Actual behavior
After some time, an exception from HttpClient occurs complaining about port exaustion.
Possible Solution
There is a solution on .net classic described here https://softwareengineering.stackexchange.com/questions/330364/should-we-create-a-new-single-instance-of-httpclient-for-all-requests
For .net core, the solution is to use IHttpClientFactory, which needs to be adapted. Microsoft.Identity.Web should showcase how to do this. A better default for MSAL needs some investigation.
Which Version of MSAL are you using ?
4.11
Platform
net45, netcore
Affects confidential clients
Repro
Expected behavior
MSAL should work
Actual behavior
After some time, an exception from HttpClient occurs complaining about port exaustion.
Possible Solution
There is a solution on .net classic described here https://softwareengineering.stackexchange.com/questions/330364/should-we-create-a-new-single-instance-of-httpclient-for-all-requests
For .net core, the solution is to use IHttpClientFactory, which needs to be adapted. Microsoft.Identity.Web should showcase how to do this. A better default for MSAL needs some investigation.