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

適用於