SocketsHttpHandler.PooledConnectionLifetime 属性

定义

获取或设置连接在池中可被视为可重用的时间。

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

属性值

连接在池中的最大时间。 此属性的默认值为 InfiniteTimeSpan.

例外

指定的值小于 Zero (除外 InfiniteTimeSpan)。

已在当前实例上启动操作。

已释放当前实例。

注解

此属性定义池中的最大连接生存期,从建立连接时跟踪其年龄,而不考虑其空闲时间或活动时间。 在主动用于服务请求时,连接不会中断。 此生存期非常有用,以便定期重新建立连接,以便更好地反映 DNS 或其他网络更改。

如果连接终结点不是域名,而是 IP 地址,则该值可以是 InfiniteTimeSpan

适用于