ServicePointManager.MaxServicePointIdleTime Propiedad

Definición

Obtiene o establece el tiempo de inactividad máximo de un 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 de propiedad

El tiempo de inactividad máximo, en milisegundos, de un objeto ServicePoint. El valor predeterminado es 100.000 milisegundos (100 segundos).

Excepciones

Ejemplos

En el ejemplo de código siguiente se establece esta propiedad.

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

Comentarios

La MaxServicePointIdleTime propiedad establece el tiempo de inactividad máximo que el ServicePointManager objeto asigna a la MaxIdleTime propiedad al crear ServicePoint objetos. Los cambios en este valor solo ServicePoint afectan a los objetos que se inicializan después de cambiar el valor.

Después de que un ServicePoint objeto haya estado inactivo durante el tiempo especificado en MaxIdleTime, es apto para la recolección de elementos no utilizados. Un ServicePoint objeto está inactivo cuando la lista de conexiones asociadas al ServicePoint objeto está vacía.

Se aplica a

Consulte también