ServicePointManager.MaxServicePointIdleTime Właściwość

Definicja

Pobiera lub ustawia maksymalny czas bezczynności ServicePoint obiektu.Gets or sets the maximum idle time of a ServicePoint object.

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

Wartość właściwości

Int32

Maksymalny czas bezczynności (w milisekundach) ServicePoint obiektu.The maximum idle time, in milliseconds, of a ServicePoint object. Wartość domyślna to 100 000 milisekund (100 s).The default value is 100,000 milliseconds (100 seconds).

Wyjątki

MaxServicePointIdleTime jest mniejsze niż Infinite lub większe niż MaxValue .MaxServicePointIdleTime is less than Infinite or greater than MaxValue.

Przykłady

Poniższy przykład kodu ustawia tę właściwość.The following code example sets this property.

// Set the maximum number of ServicePoint instances to 
// maintain. If a ServicePoint instance for that host already 
// exists when your application requests a connection to
// an Internet resource, the ServicePointManager object
// returns this existing ServicePoint instance. If none exists 
// for that host, it creates a new ServicePoint instance.
ServicePointManager::MaxServicePoints = 4;

// Set the maximum idle time of a ServicePoint instance to 10 seconds.
// After the idle time expires, the ServicePoint object is eligible for
// garbage collection and cannot be used by the ServicePointManager.
ServicePointManager::MaxServicePointIdleTime = 10000;

// Set the maximum number of ServicePoint instances to
// maintain. If a ServicePoint instance for that host already
// exists when your application requests a connection to
// an Internet resource, the ServicePointManager object
// returns this existing ServicePoint instance. If none exists
// for that host, it creates a new ServicePoint instance.
ServicePointManager.MaxServicePoints = 4;

// Set the maximum idle time of a ServicePoint instance to 10 seconds.
// After the idle time expires, the ServicePoint object is eligible for
// garbage collection and cannot be used by the ServicePointManager object.
ServicePointManager.MaxServicePointIdleTime = 10000;
' Set the maximum number of ServicePoint instances to maintain.
' Note that, if a ServicePoint instance for that host already 
' exists when your application requests a connection to
' an Internet resource, the ServicePointManager object
' returns this existing ServicePoint. If none exists 
' for that host, it creates a new ServicePoint instance.
ServicePointManager.MaxServicePoints = 4

' Set the maximum idle time of a ServicePoint instance to 10 seconds.
' After the idle time expires, the ServicePoint object is eligible for
' garbage collection and cannot be used by the ServicePointManager.
ServicePointManager.MaxServicePointIdleTime = 10000

Uwagi

MaxServicePointIdleTimeWłaściwość ustawia maksymalny czas bezczynności ServicePointManager przypisywany przez obiekt do MaxIdleTime właściwości podczas tworzenia ServicePoint obiektów.The MaxServicePointIdleTime property sets the maximum idle time that the ServicePointManager object assigns to the MaxIdleTime property when creating ServicePoint objects. Zmiany tej wartości mają wpływ tylko na te ServicePoint obiekty, które są inicjowane po zmianie wartości.Changes to this value affect only ServicePoint objects that are initialized after the value is changed.

Gdy ServicePoint obiekt jest bezczynny przez określony czas MaxIdleTime , jest uprawniony do wyrzucania elementów bezużytecznych.After a ServicePoint object has been idle for the time specified in MaxIdleTime, it is eligible for garbage collection. ServicePointObiekt jest bezczynny, gdy lista połączeń skojarzonych z ServicePoint obiektem jest pusta.A ServicePoint object is idle when the list of connections associated with the ServicePoint object is empty.

Dotyczy

Zobacz też