SocketsHttpHandler.PooledConnectionLifetime Property

Definition

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

C#
public TimeSpan PooledConnectionLifetime { get; set; }

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

Product Versions
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9