Controlling the Number of Outgoing Connections From HttpClient (.NET Core or Full Framework)

Here’s a quick tip from Premier Developer consultant Tim Omta about configuring the outgoing connection limit on .NET Core.  The entirety of the article appears here, but don’t forget to check out Tim’s blog directly for other helpful posts!

Although there are references to this all over the web for full framework, I had trouble finding it for .Net Core, so I thought I'd note it for others that may be searching.

On .NET Full framework, you can control the number of outgoing client connections by setting ServicePointManager.DefaultConnectionLimit to the desired number. It is 2 by default.

On .NET Core, you can set it by changing HttpClientHandler.MaxConnectionsPerServer to your desired limit. The default is int.MaxValue -- much higher than the default for the full framework.

Comments (0)

Skip to main content