ServicePointManager.MaxServicePoints Özellik

Tanım

İstediğiniz zaman korunacak en fazla nesne sayısını ServicePoint alır veya ayarlar.

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

Özellik Değeri

Korunacak en fazla ServicePoint nesne sayısı. Varsayılan değer 0'dır ve bu da nesne sayısıyla ServicePoint ilgili bir sınır olmadığı anlamına gelir.

Özel durumlar

MaxServicePoints 0'dan küçük veya Int32.MaxValue değerinden büyük.

Örnekler

Aşağıdaki kod örneği bu özelliği ayarlar.

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

Açıklamalar

Özelliği şu anda var olan nesne sayısının ServicePoint altına düşürdüğünüzdeMaxServicePoints, ServicePointManager en uzun boşta kalma sürelerine ServicePoint sahip nesneleri siler. Etkin bağlantıları olan nesne sayısı ServicePoint değerinden MaxServicePointsServicePointManager büyükse, nesne boşta olduklarında ServicePoint nesneleri siler.

Şunlara uygulanır

Ayrıca bkz.