ServicePoint.MaxIdleTime Propiedad
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
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
Comentarios
https://aka.ms/ContentUserFeedback.
Próximamente: A lo largo de 2024 iremos eliminando gradualmente las Cuestiones de GitHub como mecanismo de retroalimentación para el contenido y lo sustituiremos por un nuevo sistema de retroalimentación. Para más información, consulta:Enviar y ver comentarios de