Edit

Share via


SocketsHttpHandler.PooledConnectionLifetime Property

Definition

Gets or sets how long a connection can be in the pool to be considered reusable.

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

Property Value

The maximum time for a connection to be in the pool. The default value for this property is InfiniteTimeSpan.

Exceptions

The value specified is less than Zero or is equal to InfiniteTimeSpan.

Remarks

This property defines maximal connection lifetime in the pool, tracking its age from when the connection was established, regardless of how much time it spent idle or active. Connections are not torn down while actively being used to service requests. This lifetime is useful in order to allow connections to be reestablished periodically so as to better reflect DNS or other network changes.

If the connection endpoint is not the Domain name but the IP address, the value can be InfiniteTimeSpan.

Applies to