gpt4 book ai didi

.net - .net核心中的ServicePointManager.DefaultConnectionLimit?

转载 作者:行者123 更新时间:2023-12-03 21:41:36 26 4
gpt4 key购买 nike

我将Web api 2服务移植到.net核心,并且在我的旧Web api服务中找到了这一行。

ServicePointManager.DefaultConnectionLimit = int.MaxValue;

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

如何在.net核心中修改/增加DefaultConnectionLimit。另外,我什至不知道.net core的默认限制是多少? (如果这是一个有效的问题:))

最佳答案

在ASP.NET 5应用程序中,使用WinHttpHandler.MaxConnectionsPerServer。其默认值为int.MaxValue

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

What to do in ASP.NET 5 apps...

关于.net - .net核心中的ServicePointManager.DefaultConnectionLimit?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36398474/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com