ServicePointManager.MaxServicePointIdleTime Propriedade

Definição

Obtém ou define o tempo ocioso máximo de um objeto ServicePoint.

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

Valor da propriedade

O tempo ocioso máximo, em milissegundos, de um objeto ServicePoint. O valor padrão é 100.000 milissegundos (100 segundos).

Exceções

Exemplos

O exemplo de código a seguir define essa propriedade.

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

Comentários

A MaxServicePointIdleTime propriedade define o tempo ocioso máximo que o ServicePointManager objeto atribui à MaxIdleTime propriedade ao criar ServicePoint objetos. As alterações nesse valor afetam apenas ServicePoint os objetos que são inicializados depois que o valor é alterado.

Depois que um ServicePoint objeto estiver ocioso pelo tempo especificado em MaxIdleTime, ele será qualificado para coleta de lixo. Um ServicePoint objeto fica ocioso quando a lista de conexões associadas ao ServicePoint objeto está vazia.

Aplica-se a

Confira também