ReliableSessionBindingElement クラス

定義

エンドポイント間の信頼できるセッションに必要な送受信チャネルを生成できるバインディング要素を表します。

public ref class ReliableSessionBindingElement sealed : System::ServiceModel::Channels::BindingElement
public ref class ReliableSessionBindingElement sealed : System::ServiceModel::Channels::BindingElement, System::ServiceModel::Description::IPolicyExportExtension
public sealed class ReliableSessionBindingElement : System.ServiceModel.Channels.BindingElement
public sealed class ReliableSessionBindingElement : System.ServiceModel.Channels.BindingElement, System.ServiceModel.Description.IPolicyExportExtension
type ReliableSessionBindingElement = class
    inherit BindingElement
type ReliableSessionBindingElement = class
    inherit BindingElement
    interface IPolicyExportExtension
Public NotInheritable Class ReliableSessionBindingElement
Inherits BindingElement
Public NotInheritable Class ReliableSessionBindingElement
Inherits BindingElement
Implements IPolicyExportExtension
継承
ReliableSessionBindingElement
実装

ReliableSessionBindingElementは、任意のカスタム バインドに追加できます。 これは、次の構成要素を使用して行われます。

<bindings>
    <customBinding>
        <binding configurationName="ReliabilityHTTP">
            <reliableSession/>
        </binding>
    </customBinding>
</bindings>

次のサンプル コードは、コードで ReliableSessionBindingElement を使用する方法を示しています。

Uri baseAddress = new Uri("http://localhost:8000/servicemodelsamples/service");

// Create a ServiceHost for the CalculatorService type and provide the base address.
using (ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress))
{
    // Create a custom binding that contains two binding elements.
    ReliableSessionBindingElement reliableSession = new ReliableSessionBindingElement();
    reliableSession.Ordered = true;

    HttpTransportBindingElement httpTransport = new HttpTransportBindingElement();
    httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous;
    httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;

    CustomBinding binding = new CustomBinding(reliableSession, httpTransport);

    // Add an endpoint using that binding.
    serviceHost.AddServiceEndpoint(typeof(ICalculator), binding, "");

    // Add a MEX endpoint.
    ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
    smb.HttpGetEnabled = true;
    smb.HttpGetUrl = new Uri("http://localhost:8001/servicemodelsamples");
    serviceHost.Description.Behaviors.Add(smb);

    // Open the ServiceHostBase to create listeners and start listening for messages.
    serviceHost.Open();

    // The service can now be accessed.
    Console.WriteLine("The service is ready.");
    Console.WriteLine("Press <ENTER> to terminate service.");
    Console.WriteLine();
    Console.ReadLine();

    // Close the ServiceHostBase to shutdown the service.
    serviceHost.Close();
}
Dim baseAddress As New Uri("http://localhost:8000/servicemodelsamples/service")

' Create a ServiceHost for the CalculatorService type and provide the base address.
Using serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)
    ' Create a custom binding that contains two binding elements.
    Dim reliableSession As New ReliableSessionBindingElement()
    reliableSession.Ordered = True

    Dim httpTransport As New HttpTransportBindingElement()
    httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous
    httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard

    Dim binding As New CustomBinding(reliableSession, httpTransport)

    ' Add an endpoint using that binding.
    serviceHost.AddServiceEndpoint(GetType(ICalculator), binding, "")

    ' Add a MEX endpoint.
    Dim smb As New ServiceMetadataBehavior()
    smb.HttpGetEnabled = True
    smb.HttpGetUrl = New Uri("http://localhost:8001/servicemodelsamples")
    serviceHost.Description.Behaviors.Add(smb)

    ' Open the ServiceHostBase to create listeners and start listening for messages.
    serviceHost.Open()

    ' The service can now be accessed.
    Console.WriteLine("The service is ready.")
    Console.WriteLine("Press <ENTER> to terminate service.")
    Console.WriteLine()
    Console.ReadLine()

    ' Close the ServiceHostBase to shutdown the service.
    serviceHost.Close()
End Using

注釈

セッションを提供し、必要に応じて順序付けされたメッセージ配信を提供します。 この実装されたセッションは、SOAP とトランスポートの中継局をまたがる可能性があります。

各バインド要素は、メッセージの送受信時の処理ステップを表します。 実行時に、バインディング要素は、メッセージの送受信に必要な送信チャネル スタックと受信チャネル スタックを構築するために必要なチャネル ファクトリとリスナーを作成します。 ReliableSessionBindingElementは、エンドポイント間で信頼性の高いセッションを確立し、このセッションの動作を構成できる、スタック内のオプションレイヤーを提供します。

ReliableSessionBindingElementは、次の表の標準バインドで提供されています。

Binding デフォルト
NetTcpBinding オフ
WSHttpBinding オフ
WSDualHttpBinding オン (必須)

コンストラクター

名前 説明
ReliableSessionBindingElement()

ReliableSessionBindingElement クラスの新しいインスタンスを初期化します。

ReliableSessionBindingElement(Boolean)

メッセージ配信でメッセージの送信順序を保持する必要があるかどうかを指定する、 ReliableSessionBindingElement クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
AcknowledgementInterval

ファクトリによって作成された信頼できるチャネルでメッセージ ソースに受信確認を送信するまでの宛先の待機時間を取得または設定します。

FlowControlEnabled

信頼できるセッションでフロー制御が有効になっているかどうかを示す値を取得または設定します。

InactivityTimeout

閉じる前にサービスが非アクティブなままになる期間を取得または設定します。

MaxPendingChannels

信頼できるセッション中に保留できるチャネルの最大数を取得または設定します。

MaxRetryCount

信頼できるセッション中にメッセージが転送される最大回数を取得または設定します。

MaxTransferWindowSize

送信バッファーまたは受信バッファーに存在できるメッセージの最大数を取得または設定します。

Ordered

メッセージ配信でメッセージの送信順序を保持する必要があるかどうかを示す値を取得または設定します。

ReliableMessagingVersion

バインド要素によって指定された WS-ReliableMessaging のバージョンを取得または設定します。

メソッド

名前 説明
BuildChannelFactory<TChannel>(BindingContext)

信頼できるセッションをサポートする指定した型のチャネルを作成するファクトリを返します。

BuildChannelListener<TChannel>(BindingContext)

信頼できるセッションをサポートする、指定した種類のチャネルを受け入れるリスナーを返します。

CanBuildChannelFactory<TChannel>(BindingContext)

信頼できるセッションをサポートできるチャネルとコンテキストに対してチャネル ファクトリを構築できるかどうかを示す値を返します。

CanBuildChannelListener<TChannel>(BindingContext)

信頼できるセッションをサポートできるチャネルとコンテキストに対してチャネル リスナーを構築できるかどうかを示す値を返します。

Clone()

現在の信頼できるセッション バインド要素のコピーを作成します。

Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetProperty<T>(BindingContext)

バインド コンテキストから、指定した型のプロパティを取得します。

GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

名前 説明
IPolicyExportExtension.ExportPolicy(MetadataExporter, PolicyConversionContext)

信頼できるセッション バインド要素に含まれる情報を WSDL 要素にマップします。この要素を使用して、リモート エンドポイントが信頼できるセッションを使用してサービスにアクセスできるようにします。

適用対象