ContextBindingElement 類別

定義

提供保護等級與交換機制做為繫結項目內容的一部分,也提供建置通道接聽程式與處理站的功能。

public ref class ContextBindingElement : System::ServiceModel::Channels::BindingElement, System::ServiceModel::Channels::IContextBindingElement, System::ServiceModel::Description::IPolicyExportExtension
public class ContextBindingElement : System.ServiceModel.Channels.BindingElement, System.ServiceModel.Channels.IContextBindingElement, System.ServiceModel.Description.IPolicyExportExtension
type ContextBindingElement = class
    inherit BindingElement
    interface IPolicyExportExtension
    interface IContextBindingElement
Public Class ContextBindingElement
Inherits BindingElement
Implements IContextBindingElement, IPolicyExportExtension
繼承
ContextBindingElement
實作

備註

ContextBindingElement 可讓使用者在服務繫結中新增項目,以管理其內容交換通訊協定。 ContextBindingElement 通常堆疊在可靠性、安全性與傳輸繫結項目的頂端。 ContextBindingElement 不需要任何組態選項,並可建立 IRequestChannelIRequestSessionChannelIDuplexSessionChannel 的通道處理站。 它也可以建立 IReplyChannelIReplySessionChannelIDuplexSessionChannel 的通道接聽程式。 內容通道不會變更通道介面 - 基礎通道堆疊必須支援要求的通道圖形和會話功能。

通道接聽程式和處理站是用來建構處理傳入和傳出訊息時使用的部分通道堆疊。

注意

如果會話型系結是以 建立 ContextBindingElement ,並搭配指定 NotAllowedSessionMode = InvalidOperationException 的合約使用 ,則會在建立通道時使用下列文字擲回 :「通道內容管理無法在開啟通道之後啟用或停用」。您必須將 設定 SessionModeAllowedRequired 不使用會話型通道。

建立自訂繫結時,建議您先將 ContextBindingElement 新增至自訂繫結的 BindingElementCollection,然後再新增任何可靠性與安全性繫結項目 (若有的話)。 如果沒有這麼做,您的服務可能就會擲回 ProtocolException,並附帶以下訊息︰

「內容通道收到具有內容的訊息,但它不符合目前在通道快取的內容。 請確定服務的內容與原先設定時相同,或透過將通道屬性 'IContextManager.Enabled' 設定為 false 以停用內容管理。」

建構函式

ContextBindingElement()

初始化 ContextBindingElement 類別的新執行個體。

ContextBindingElement(ProtectionLevel)

使用指定的保護等級,初始化 ContextBindingElement 類別的新執行個體。

ContextBindingElement(ProtectionLevel, ContextExchangeMechanism)

使用指定的保護等級與交換機制,初始化 ContextBindingElement 類別的新執行個體。

ContextBindingElement(ProtectionLevel, ContextExchangeMechanism, Uri)

使用指定的保護等級、內容交換機制與用戶端回呼位址,初始化 ContextBindingElement 類別的新執行個體。

ContextBindingElement(ProtectionLevel, ContextExchangeMechanism, Uri, Boolean)

使用指定的保護等級、內容交換機制、用戶端回呼位址,以及指定是否啟用內容管理的值,初始化 ContextBindingElement 類別的新執行個體。

屬性

ClientCallbackAddress

取得或設定繫結項目的用戶端回呼位址。

ContextExchangeMechanism

取得或設定用來傳送繫結項目內容的交換機制。

ContextManagementEnabled

取得或設定值,這個值會指定內容管理是否已啟用。

ProtectionLevel

取得或設定來自內容之繫結項目的保護等級。

方法

BuildChannelFactory<TChannel>(BindingContext)

在用戶端上建置通道處理站堆疊,這個堆疊會針對指定的內容建立指定的通道類型。

BuildChannelListener<TChannel>(BindingContext)

在用戶端上建置通道接聽程式堆疊,這個堆疊會針對指定的內容接受指定的通道類型。

CanBuildChannelFactory<TChannel>(BindingContext)

傳回值,這個值會指出目前的繫結項目是否可以建置指定之通道及內容型別的處理站。

CanBuildChannelListener<TChannel>(BindingContext)

傳回值,這個值會指出目前的繫結是否可以建置指定之通道及內容類型的接聽程式。

Clone()

新建一個從目前 ContextBindingElement 物件初始化的這類物件。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
ExportPolicy(MetadataExporter, PolicyConversionContext)

將自訂原則判斷提示寫入繫結項目的內容。

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetProperty<T>(BindingContext)

從通道堆疊的適當層次中,傳回含有指定內容的型別物件。

GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於