ServicePointManager.DefaultConnectionLimit Property (System.Net)

Switch View :
ScriptFree
.NET Framework Class Library
ServicePointManager.DefaultConnectionLimit Property

Gets or sets the maximum number of concurrent connections allowed by a ServicePoint object.

Namespace:  System.Net
Assembly:  System (in System.dll)
Syntax

Visual Basic
Public Shared Property DefaultConnectionLimit As Integer
C#
public static int DefaultConnectionLimit { get; set; }
Visual C++
public:
static property int DefaultConnectionLimit {
	int get ();
	void set (int value);
}
F#
static member DefaultConnectionLimit : int with get, set

Property Value

Type: System.Int32
The maximum number of concurrent connections allowed by a ServicePoint object. The default value is 2.
Exceptions

Exception Condition
ArgumentOutOfRangeException

DefaultConnectionLimit is less than or equal to 0.

Remarks

The DefaultConnectionLimit property sets the default maximum number of concurrent connections that the ServicePointManager object assigns to the ConnectionLimit property when creating ServicePoint objects.

Changing the DefaultConnectionLimit property has no effect on existing ServicePoint objects; it affects only ServicePoint objects that are initialized after the change. If the value of this property has not been set either directly or through configuration, the value defaults to the constant DefaultPersistentConnectionLimit.

Note Note

Any changes to the DefaultConnectionLimit property affect both HTTP 1.0 and HTTP 1.1 connections. It is not possible to separately alter the connection limit for HTTP 1.0 and HTTP 1.1 protocols. When used in the server environment (ASP.NET) DefaultConnectionLimit defaults to higher number of connections, which is 10.

Examples

The following code example sets this property.

Visual Basic

ServicePointManager.UseNagleAlgorithm = True
ServicePointManager.Expect100Continue = True
ServicePointManager.CheckCertificateRevocationList = True
ServicePointManager.DefaultConnectionLimit = _
    ServicePointManager.DefaultPersistentConnectionLimit


C#

ServicePointManager.UseNagleAlgorithm = true;
ServicePointManager.Expect100Continue = true;
ServicePointManager.CheckCertificateRevocationList = true;
ServicePointManager.DefaultConnectionLimit = ServicePointManager.DefaultPersistentConnectionLimit;


Visual C++

ServicePointManager::UseNagleAlgorithm = true;
ServicePointManager::Expect100Continue = true;
ServicePointManager::CheckCertificateRevocationList = true;
ServicePointManager::DefaultConnectionLimit = ServicePointManager::DefaultPersistentConnectionLimit;



Version Information

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
.NET Framework Security

Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
See Also

Reference

Community Content

Siva M
DefaultConnectionLimit in ASP.NET
DefaultConnectionLimit defaults to 12 per core in ASP.NET; it is not 10 as mentioned in this documentation. For example, on a quad-core server, DefaultConnectionLimit is 48.

Mathieu_D
<connectionManagement> may also help
If your changes to DefaultConnectionLimit does not change anything, try <connectionManagement> setting in your app.config.
cf http://msdn.microsoft.com/en-us/library/fb6y0fyc.aspx