Freigeben über


ServicePointManager.MaxServicePointIdleTime-Eigenschaft

Ruft die maximale Leerlaufzeit eines ServicePoint-Objekts ab oder legt diese fest.

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

Syntax

'Declaration
Public Shared Property MaxServicePointIdleTime As Integer
'Usage
Dim value As Integer

value = ServicePointManager.MaxServicePointIdleTime

ServicePointManager.MaxServicePointIdleTime = value
public static int MaxServicePointIdleTime { get; set; }
public:
static property int MaxServicePointIdleTime {
    int get ();
    void set (int value);
}
/** @property */
public static int get_MaxServicePointIdleTime ()

/** @property */
public static void set_MaxServicePointIdleTime (int value)
public static function get MaxServicePointIdleTime () : int

public static function set MaxServicePointIdleTime (value : int)

Eigenschaftenwert

Die maximale Leerlaufzeit eines ServicePoint-Objekts in Millisekunden. Der Standardwert ist 100.000 Millisekunden (100 Sekunden).

Ausnahmen

Ausnahmetyp Bedingung

ArgumentOutOfRangeException

MaxServicePointIdleTime ist kleiner als Timeout.Infinite oder größer als Int32.MaxValue.

Hinweise

Die MaxServicePointIdleTime-Eigenschaft legt die maximale Leerlaufzeit fest, die das ServicePointManager-Objekt beim Erstellen von ServicePoint-Objekten der MaxIdleTime-Eigenschaft zuweist. Änderungen an diesem Wert wirken sich nur auf ServicePoint-Objekte aus, die nach Änderung des Werts initialisiert werden.

Wenn sich ein ServicePoint-Objekt über die in MaxIdleTime angegebene Zeitspanne im Leerlauf befunden hat, ist es für die Garbage Collection verfügbar. Ein ServicePoint-Objekt befindet sich im Leerlauf, wenn die Liste der dem ServicePoint-Objekt zugeordneten Verbindungen leer ist.

Beispiel

Im folgenden Codebeispiel wird diese Eigenschaft festgelegt.

' 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
// 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. 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.set_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.set_MaxServicePointIdleTime(10000);

.NET Framework-Sicherheit

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

ServicePointManager-Klasse
ServicePointManager-Member
System.Net-Namespace