Does HttpClient use the same ServicePoint Connection Limit as HttpWebRequest?
Thanks
Does HttpClient use the same ServicePoint Connection Limit as HttpWebRequest?
Thanks
The answer is not complete. It depends on implementation. In .net core ServicePointManager.DefaultConnectionLimit setting is not used, HttpClientHandler.MaxConnectionsPerServer should be used instead.
It uses the same ServicePointManager so the answer is yes.
You can change the limit programmatically though if you want, see this
Since I couldn't find an official answer anywhere in the docs, decompiling the code for .NET 6 yields a default value of int.MaxValue
for HttpClientHandler.MaxConnectionsPerServer
.
This should also be true for any version of .NET Core.
namespace System.Net.Http
{
internal static partial class HttpHandlerDefaults
{
public const int DefaultMaxConnectionsPerServer = int.MaxValue;
...
}
}