.NET client connection Limit

调试出了一个诡异的问题,使用多个进程没问题,单进程出现了。

fix:

//默认限制为2个连接
//public const int DefaultPersistentConnectionLimit = 2;
ServicePointManager.DefaultConnectionLimit = int.MaxValue;

        // Summary:
        //     The default number of non-persistent connections (4) allowed on a System.Net.ServicePoint
        //     object connected to an HTTP/1.0 or later server. This field is constant but
        //     is no longer used in the .NET Framework 2.0.
        public const int DefaultNonPersistentConnectionLimit = 4;
        //
        // Summary:
        //     The default number of persistent connections (2) allowed on a System.Net.ServicePoint
        //     object connected to an HTTP/1.1 or later server. This field is constant and
        //     is used to initialize the System.Net.ServicePointManager.DefaultConnectionLimit
        //     property if the value of the System.Net.ServicePointManager.DefaultConnectionLimit
        //     property has not been set either directly or through configuration.
        public const int DefaultPersistentConnectionLimit = 2;
原文地址:https://www.cnblogs.com/chinaniit/p/3317143.html