ServicePointManager.MaxServicePointIdleTime Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient ou définit le temps d'inactivité maximal d'un objet 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
Valeur de propriété
Temps d'inactivité maximal, en millisecondes, d'un objet ServicePoint. La valeur par défaut est 100 000 millisecondes (100 secondes).
Exceptions
MaxServicePointIdleTime est inférieur Infinite ou supérieur à Int32.MaxValue.
Exemples
L’exemple de code suivant définit cette propriété.
// 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
Remarques
La MaxServicePointIdleTime propriété définit le temps d’inactivité maximal que l’objet ServicePointManager attribue à la propriété lors de la MaxIdleTime création d’objets ServicePoint . Les modifications apportées à cette valeur affectent uniquement ServicePoint les objets qui sont initialisés après la modification de la valeur.
Une fois qu’un ServicePoint objet a été inactif pendant le temps spécifié dans MaxIdleTime, il est éligible pour le garbage collection. Un ServicePoint objet est inactif lorsque la liste des connexions associées à l’objet ServicePoint est vide.