ServicePointManager.MaxServicePoints Eigenschaft

Definition

Ruft die maximale Anzahl von ServicePoint-Objekten ab, die jederzeit verwaltet werden sollen, oder legt diese fest.

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

Eigenschaftswert

Die maximale Anzahl der zu verwaltenden ServicePoint-Objekte. Der Standardwert ist 0, d. h., dass die Anzahl der ServicePoint-Objekte unbegrenzt ist.

Ausnahmen

MaxServicePoints ist kleiner als 0 oder größer als Int32.MaxValue.

Beispiele

Im folgenden Codebeispiel wird diese Eigenschaft festgelegt.

// 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

Hinweise

Wenn Sie die MaxServicePoints Eigenschaft unter die Anzahl der ServicePoint derzeit vorhandenen Objekte reduzieren, ServicePointManager werden die Objekte mit den ServicePoint längsten Leerlaufzeiten gelöscht. Wenn die Anzahl der ServicePoint Objekte mit aktiven Verbindungen größer als der Wert von MaxServicePointsist, löscht das ServicePointManager Objekt die ServicePoint Objekte, wenn sie im Leerlauf stehen.

Gilt für:

Weitere Informationen