HttpTransportBindingElement.KeepAliveEnabled 屬性

定義

取得或設定值,這個值表示是否要與服務端點建立持續連線。

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

屬性值

如果對服務端點的要求應該包含具有值 true 的連線 HTTP 標頭,則為 Keep-alive,否則為 false。 預設為 true

範例

下列程式碼將示範如何設定這個屬性。

HttpTransportBindingElement transport = new HttpTransportBindingElement();
transport.ManualAddressing = true;
transport.KeepAliveEnabled = keepAliveEnabled;

備註

設定這個屬性為 true,以傳送具有 Keep-alive 值的連線 HTTP 標頭。 用戶端會使用這個屬性來表示持續連線的偏好設定。 當這個屬性為 true 時,如果服務端點支援用戶端對服務端點的連線,該連線就會持續。

適用於