Skip to content

[Feature Request] Prevent HttpClient port exhaustion  #1756

@bgavrilMS

Description

@bgavrilMS

Which Version of MSAL are you using ?
4.11

Platform
net45, netcore

Affects confidential clients

Repro

  1. Do not provide a custom IHttpFactory
  2. 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions