ServicePoint.MaxIdleTime Propiedad

Definición

Obtiene o establece la cantidad de tiempo que una conexión asociada al objeto ServicePoint puede permanecer inactiva antes de cerrarse.

public:
 property int MaxIdleTime { int get(); void set(int value); };
public int MaxIdleTime { get; set; }
member this.MaxIdleTime : int with get, set
Public Property MaxIdleTime As Integer

Valor de propiedad

Duración, expresada en milisegundos, que una conexión asociada al objeto ServicePoint puede permanecer inactiva antes de que se cierre y la utilice otra conexión.

Excepciones

MaxIdleTime se establece en menor Infinite o mayor que Int32.MaxValue.

Ejemplos

En el ejemplo de código siguiente se usa la MaxIdleTime propiedad para establecer y recuperar el tiempo de ServicePoint inactividad.

// Display the date and time that the ServicePoint was last 
// connected to a host.
Console::WriteLine( "IdleSince = {0}", sp->IdleSince );

// Display the maximum length of time that the ServicePoint instance  
// is allowed to maintain an idle connection to an Internet  
// resource before it is recycled for use in another connection.
Console::WriteLine( "MaxIdleTime = {0}", sp->MaxIdleTime );
// Display the date and time that the ServicePoint was last
// connected to a host.
Console.WriteLine("IdleSince = " + sp.IdleSince.ToString());

// Display the maximum length of time that the ServicePoint instance
// is allowed to maintain an idle connection to an Internet
// resource before it is recycled for use in another connection.
Console.WriteLine("MaxIdleTime = " + sp.MaxIdleTime);
' Display the date and time that the ServicePoint was last 
' connected to a host.
Console.WriteLine(("IdleSince = " + sp.IdleSince.ToString()))


' Display the maximum length of time that the ServicePoint instance 
' is allowed to maintain an idle connection to an Internet  
' resource before it is recycled for use in another connection.
Console.WriteLine(("MaxIdleTime = " + sp.MaxIdleTime.ToString()))

Comentarios

Puede establecer en MaxIdleTimeTimeout.Infinite para indicar que una conexión asociada al ServicePoint objeto nunca debe agotar el tiempo de espera.

El valor predeterminado de la MaxIdleTime propiedad es el valor de la ServicePointManager.MaxServicePointIdleTime propiedad cuando se crea el ServicePoint objeto. Los cambios posteriores en la MaxServicePointIdleTime propiedad no tienen ningún efecto en los objetos existentes ServicePoint .

Cuando se supera para MaxIdleTime una conexión asociada a , ServicePoint la conexión permanece abierta hasta que la aplicación intenta usar la conexión. En ese momento, framework cierra la conexión y crea una nueva conexión al host remoto.

Se aplica a