ServicePoint.MaxIdleTime 속성

정의

연결이 닫히기 전에 개체와 연결된 연결이 ServicePoint 유휴 상태로 유지될 수 있는 시간을 가져오거나 설정합니다.

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

속성 값

개체와 연결된 ServicePoint 연결이 닫히고 다른 연결에 다시 사용되기 전에 유휴 상태로 유지될 수 있는 시간(밀리초)입니다.

예외

MaxIdleTime Infinite보다 작거나 큰 값으로 설정됩니다.

예제

다음 코드 예제에서는 속성을 설정 MaxIdleTime 하 고 유휴 시간을 검색 ServicePoint 합니다.

// Display the date and time that the ServicePoint was last
// connected to a host.
Console.WriteLine("IdleSince = " + sp.IdleSince.ToString());

// Display the maximum length of time that the ServicePoint instance
// is allowed to maintain an idle connection to an Internet
// resource before it is recycled for use in another connection.
Console.WriteLine("MaxIdleTime = " + sp.MaxIdleTime);
' Display the date and time that the ServicePoint was last 
' connected to a host.
Console.WriteLine(("IdleSince = " + sp.IdleSince.ToString()))


' Display the maximum length of time that the ServicePoint instance 
' is allowed to maintain an idle connection to an Internet  
' resource before it is recycled for use in another connection.
Console.WriteLine(("MaxIdleTime = " + sp.MaxIdleTime.ToString()))

설명

Caution

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

개체와 MaxIdleTime 연결된 연결이 시간 초과되지 않아야 함을 나타내도록 Timeout.Infinite 설정할 ServicePoint 수 있습니다.

속성의 MaxIdleTime 기본값은 개체를 ServicePointManager.MaxServicePointIdleTime 만들 때 속성의 ServicePoint 값입니다. 속성에 대한 MaxServicePointIdleTime 후속 변경 내용은 기존 ServicePoint 개체에 영향을 주지 않습니다.

연결된 MaxIdleTime 연결에 ServicePoint 대한 연결이 초과되면 애플리케이션이 연결을 사용하려고 할 때까지 연결이 열린 상태로 유지됩니다. 이때 프레임워크는 연결을 닫고 원격 호스트에 대한 새 연결을 만듭니다.

메모

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

적용 대상