ServicePointManager.DefaultConnectionLimit 在 .net 核心中?

ServicePointManager.DefaultConnectionLimit in .net core?

我正在将 web api 2 服务移植到 .net core,我在我的旧 web api 服务中找到了这一行。

ServicePointManager.DefaultConnectionLimit = int.MaxValue;

这行代码增加了连接限制。我不知道它是针对计算机还是框架还是仅针对应用程序。在阅读了 Whosebug 上的 this 答案后,我也意识到将其设置为 int.max 可能不是最好的主意。但是,我仍然希望在我的新 .net 核心服务中控制它。

如何 modify/increase .net 核心中的 DefaultConnectionLimit。另外,我怎么知道 .net core 中的默认限制是多少? (如果这是一个有效的问题 :) )

在 ASP.NET 5 个应用中,使用 WinHttpHandler.MaxConnectionsPerServer。它的默认值为 int.MaxValue

有关详细信息,请参阅 .NET Portability Analyzer from the Visual Studio Gallery and WinHttpHandler.MaxConnectionsPerServer on MSDN