다음을 통해 공유


ServicePoint.ConnectionLimit 속성

정의

ServicePoint 개체에 허용되는 최대 연결 수를 가져오거나 설정합니다.

public:
 property int ConnectionLimit { int get(); void set(int value); };
public int ConnectionLimit { get; set; }
member this.ConnectionLimit : int with get, set
Public Property ConnectionLimit As Integer

속성 값

ServicePoint 개체에 허용되는 최대 연결 수입니다.

예외

연결 제한은 0보다 작거나 같습니다.

예제

다음 코드 예제에서는 지정 된 URI (Uniform Resource Identifier)에 개체를 만들 수 있는 ServicePoint 연결의 최대 수를 확인 하는 속성을 사용 합니다ConnectionLimit.

Console.WriteLine("ConnectionName = " + sp.ConnectionName);

// Display the maximum number of connections allowed on this
// ServicePoint instance.
Console.WriteLine("ConnectionLimit = " + sp.ConnectionLimit);

// Display the number of connections associated with this
// ServicePoint instance.
Console.WriteLine("CurrentConnections = " + sp.CurrentConnections);
Console.WriteLine(("ConnectionName = " + sp.ConnectionName))

' Display the maximum number of connections allowed on this 
' ServicePoint instance.
Console.WriteLine(("ConnectionLimit = " + sp.ConnectionLimit.ToString()))

' Display the number of connections associated with this 
' ServicePoint instance.
Console.WriteLine(("CurrentConnections = " + sp.CurrentConnections.ToString()))

설명

주의

WebRequest, HttpWebRequest, ServicePointWebClient 사용되지 않으므로 새 개발에 사용하면 안 됩니다. HttpClient를 대신 사용하세요.

이 속성은 ConnectionLimit 개체가 인터넷 리소스에 ServicePoint 대해 만들 수 있는 최대 연결 수를 설정합니다. 개체를 ConnectionLimit 만들 때 ServicePoint 속성 값이 속성 값 ServicePointManager.DefaultConnectionLimit 으로 설정되고, 이후 변경 DefaultConnectionLimit 내용이 기존 ServicePoint 개체에 영향을 주지 않습니다.

프록시 연결 또는 프록시 터널에는 연결 제한이 적용되지 않습니다.

메모

.NET 9부터 이 속성은 .에 매핑됩니다 SocketsHttpHandler.MaxConnectionsPerServer. 그러나 처리기는 요청 간에 재사용되지 않으므로 의미 있는 영향을 주지 않습니다.

적용 대상

추가 정보