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

适用于