WSHttpBindingBase クラス

定義

WSHttpBindingWSFederationHttpBindingに共通するメンバーを基底クラスに提供します。

public ref class WSHttpBindingBase abstract : System::ServiceModel::Channels::Binding
public ref class WSHttpBindingBase abstract : System::ServiceModel::Channels::Binding, System::ServiceModel::Channels::IBindingRuntimePreferences
public abstract class WSHttpBindingBase : System.ServiceModel.Channels.Binding
public abstract class WSHttpBindingBase : System.ServiceModel.Channels.Binding, System.ServiceModel.Channels.IBindingRuntimePreferences
type WSHttpBindingBase = class
    inherit Binding
type WSHttpBindingBase = class
    inherit Binding
    interface IBindingRuntimePreferences
Public MustInherit Class WSHttpBindingBase
Inherits Binding
Public MustInherit Class WSHttpBindingBase
Inherits Binding
Implements IBindingRuntimePreferences
継承
WSHttpBindingBase
派生
実装

次の例は、派生クラス、WSHttpBinding、およびWSFederationHttpBindingで、WSHttpBindingBase クラスによって提供される機能を使用する方法を示しています。


// Define a service contract for the calculator.
[ServiceContract()]
public interface ICalculator
{
    [OperationContract(IsOneWay = false)]
    double Add(double n1, double n2);
    [OperationContract(IsOneWay = false)]
    double Subtract(double n1, double n2);
    [OperationContract(IsOneWay = false)]
    double Multiply(double n1, double n2);
    [OperationContract(IsOneWay = false)]
    double Divide(double n1, double n2);
}

// Service class which implements the service contract.
public class CalculatorService : ICalculator
{
    public double Add(double n1, double n2)
    {
        double result = n1 + n2;
        return result;
    }

    public double Subtract(double n1, double n2)
    {
        double result = n1 - n2;
        return result;
    }

    public double Multiply(double n1, double n2)
    {
        double result = n1 * n2;
        return result;
    }

    public double Divide(double n1, double n2)
    {
        double result = n1 / n2;
        return result;
    }

    // Create and configure bindings within this EXE console application.
    public static void Main()
    {
        // Create a WSHttpBinding
        WSHttpBinding binding1 = new WSHttpBinding();

    binding1.BypassProxyOnLocal =  true;

    EnvelopeVersion envelopeVersion =
    binding1.EnvelopeVersion;

    HostNameComparisonMode hostnameComparisonMode =
    binding1.HostNameComparisonMode;

    long maxBufferPoolSize =
        binding1.MaxBufferPoolSize;

    long maxReceivedMessageSize =
    binding1.MaxReceivedMessageSize;

    WSMessageEncoding messageEncoding =
    binding1.MessageEncoding;

    Uri proxyAddress =
        binding1.ProxyAddress;

    XmlDictionaryReaderQuotas readerQuotas =
    binding1.ReaderQuotas;

    OptionalReliableSession reliableSession =
    binding1.ReliableSession;

    string scheme = binding1.Scheme;

    Encoding textEncoding =
        binding1.TextEncoding;

    bool transactionFlow =
        binding1.TransactionFlow;

    bool useDefaultWebProxy =
        binding1.UseDefaultWebProxy;

    BindingElementCollection bindingElements =
            binding1.CreateBindingElements();

        // Set WSHttpBinding binding property values
        binding1.Name = "Binding1";
        binding1.HostNameComparisonMode =
           HostNameComparisonMode.StrongWildcard;
        binding1.Security.Mode = SecurityMode.Message;
        binding1.ReliableSession.Enabled = false;
        binding1.TransactionFlow = false;
       // binding1.Security.Message.DefaultProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign;

        // Enumerate properties of the binding1.
        Console.WriteLine("WSHttpBinding binding1 properties:");
        Console.WriteLine("      - name:\t\t\t{0}", binding1.Name);
        Console.WriteLine("      - hostname comparison:\t{0}", binding1.HostNameComparisonMode);
        Console.WriteLine("      - security mode:\t\t{0}", binding1.Security.Mode);
        Console.WriteLine("      - RM enabled:\t\t{0}", binding1.ReliableSession.Enabled);
        Console.WriteLine("      - transaction flow:\t{0}", binding1.TransactionFlow);
        //Console.WriteLine("      - message security:\t{0}", binding1.Security.Message.DefaultProtectionLevel);
        Console.WriteLine("      - transport scheme:\t{0}", binding1.Scheme);
        Console.WriteLine("      - max message size:\t{0}", binding1.MaxReceivedMessageSize);
        Console.WriteLine("      - default text encoding:\t{0}", binding1.TextEncoding);
        Console.WriteLine();

        // Create a WSFederationBinding with a message security mode
        // and with a reliable session enabled.
        WSFederationHttpBinding binding3 = new WSFederationHttpBinding(WSFederationHttpSecurityMode.Message, true);

        // Enumerate properties of the binding2.
        Console.WriteLine("WSFederationBinding binding3 properties:");
        Console.WriteLine("      - security mode:\t\t{0}", binding3.Security.Mode);
        Console.WriteLine("      - RM enabled:\t\t{0}", binding3.ReliableSession.Enabled);
        Console.WriteLine();
        Console.WriteLine("Press <ENTER> to terminate.");
        Console.ReadLine();
    }

static void SnippetReceiveSynchronously ()
{
    WSHttpBinding binding = new WSHttpBinding();
    IBindingRuntimePreferences s  =
                       binding.GetProperty<IBindingRuntimePreferences>
                       (new BindingParameterCollection());
    bool receiveSynchronously = s.ReceiveSynchronously;
}
}

' Define a service contract for the calculator.
<ServiceContract()> _
Public Interface ICalculator
    <OperationContract(IsOneWay := False)> _
    Function Add(ByVal n1 As Double, ByVal n2 As Double) As Double
    <OperationContract(IsOneWay := False)> _
    Function Subtract(ByVal n1 As Double, ByVal n2 As Double) As Double
    <OperationContract(IsOneWay := False)> _
    Function Multiply(ByVal n1 As Double, ByVal n2 As Double) As Double
    <OperationContract(IsOneWay := False)> _
    Function Divide(ByVal n1 As Double, ByVal n2 As Double) As Double
End Interface

' Service class which implements the service contract.
Public Class CalculatorService
    Implements ICalculator
    Public Function Add(ByVal n1 As Double, ByVal n2 As Double) As Double Implements ICalculator.Add
        Dim result = n1 + n2
        Return result
    End Function

    Public Function Subtract(ByVal n1 As Double, ByVal n2 As Double) As Double Implements ICalculator.Subtract
        Dim result = n1 - n2
        Return result
    End Function

    Public Function Multiply(ByVal n1 As Double, ByVal n2 As Double) As Double Implements ICalculator.Multiply
        Dim result = n1 * n2
        Return result
    End Function

    Public Function Divide(ByVal n1 As Double, ByVal n2 As Double) As Double Implements ICalculator.Divide
        Dim result = n1 / n2
        Return result
    End Function

    ' Create and configure bindings within this EXE console application.
    Public Shared Sub Main()
        ' Create a WSHttpBinding
        Dim binding1 As New WSHttpBinding()

    binding1.BypassProxyOnLocal = True

    Dim envelopeVersion As EnvelopeVersion = binding1.EnvelopeVersion

    Dim hostnameComparisonMode As HostNameComparisonMode = binding1.HostNameComparisonMode

        Dim maxBufferPoolSize = binding1.MaxBufferPoolSize


        Dim maxReceivedMessageSize = binding1.MaxReceivedMessageSize

    Dim messageEncoding As WSMessageEncoding = binding1.MessageEncoding

    Dim proxyAddress As Uri = binding1.ProxyAddress

    Dim readerQuotas As XmlDictionaryReaderQuotas = binding1.ReaderQuotas

    Dim reliableSession As OptionalReliableSession = binding1.ReliableSession

        Dim scheme = binding1.Scheme

        Dim textEncoding = binding1.TextEncoding

        Dim transactionFlow = binding1.TransactionFlow

        Dim useDefaultWebProxy = binding1.UseDefaultWebProxy

    Dim bindingElements As BindingElementCollection = binding1.CreateBindingElements()

        ' Set WSHttpBinding binding property values
        binding1.Name = "Binding1"
        binding1.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard
        binding1.Security.Mode = SecurityMode.Message
        binding1.ReliableSession.Enabled = False
        binding1.TransactionFlow = False
       ' binding1.Security.Message.DefaultProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign;

        ' Enumerate properties of the binding1.
        Console.WriteLine("WSHttpBinding binding1 properties:")
        Console.WriteLine("      - name:" & Constants.vbTab + Constants.vbTab + Constants.vbTab & "{0}", binding1.Name)
        Console.WriteLine("      - hostname comparison:" & Constants.vbTab & "{0}", binding1.HostNameComparisonMode)
        Console.WriteLine("      - security mode:" & Constants.vbTab + Constants.vbTab & "{0}", binding1.Security.Mode)
        Console.WriteLine("      - RM enabled:" & Constants.vbTab + Constants.vbTab & "{0}", binding1.ReliableSession.Enabled)
        Console.WriteLine("      - transaction flow:" & Constants.vbTab & "{0}", binding1.TransactionFlow)
        'Console.WriteLine("      - message security:\t{0}", binding1.Security.Message.DefaultProtectionLevel);
        Console.WriteLine("      - transport scheme:" & Constants.vbTab & "{0}", binding1.Scheme)
        Console.WriteLine("      - max message size:" & Constants.vbTab & "{0}", binding1.MaxReceivedMessageSize)
        Console.WriteLine("      - default text encoding:" & Constants.vbTab & "{0}", binding1.TextEncoding)
        Console.WriteLine()

        ' Create a WSFederationBinding with a message security mode
        ' and with a reliable session enabled.
        Dim binding3 As New WSFederationHttpBinding(WSFederationHttpSecurityMode.Message, True)

        ' Enumerate properties of the binding2.
        Console.WriteLine("WSFederationBinding binding3 properties:")
        Console.WriteLine("      - security mode:" & Constants.vbTab + Constants.vbTab & "{0}", binding3.Security.Mode)
        Console.WriteLine("      - RM enabled:" & Constants.vbTab + Constants.vbTab & "{0}", binding3.ReliableSession.Enabled)
        Console.WriteLine()
        Console.WriteLine("Press <ENTER> to terminate.")
        Console.ReadLine()

    End Sub

Private Shared Sub SnippetReceiveSynchronously()
    Dim binding As New WSHttpBinding()
    Dim s As IBindingRuntimePreferences = binding.GetProperty(Of IBindingRuntimePreferences) (New BindingParameterCollection())
        Dim receiveSynchronously = s.ReceiveSynchronously

End Sub

End Class

注釈

WSHttpBindingBaseでは、セキュリティで保護された、信頼性が高く、相互運用可能な Web サービスを構成するために使用されるバインディング (非二重サービス コントラクトの場合はWSHttpBindingによって実装される、特に、WS-Federation プロトコルをサポートするセキュリティで保護された相互運用可能なWSFederationHttpBinding用など) の基本的な機能が提供されます。

既定では、メッセージのセキュリティと認証に WS-Security、メッセージ配信用の HTTP、およびテキスト/XML メッセージ エンコードを使用するランタイム スタックが生成されます。 また、信頼性のために WS-ReliableMessaging を使用するように構成することもできます。

WS-ReliableMessaging の使用は、省略可能な reliableSessionEnabled パラメーターを使用して構成できます。

コンストラクター

名前 説明
WSHttpBindingBase()

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

WSHttpBindingBase(Boolean)

信頼できるセッションが有効かどうかを示す値を使用して、 WSHttpBindingBase クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
BypassProxyOnLocal

ローカル アドレスのプロキシ サーバーをバイパスするかどうかを示す値を取得または設定します。

CloseTimeout

トランスポートが例外を発生させる前に、接続が閉じるまでに指定された時間の間隔を取得または設定します。

(継承元 Binding)
EnvelopeVersion

このバインディングによって処理されるメッセージに使用される SOAP のバージョンを取得します。

HostNameComparisonMode

URI の照合時にホスト名を使用してサービスに到達するかどうかを示す値を取得または設定します。

MaxBufferPoolSize

このバインディングを使用してエンドポイントに必要なバッファーを管理するバッファー マネージャーに割り当てられるメモリの最大量をバイト単位で取得または設定します。

MaxReceivedMessageSize

バインディングによって処理できるメッセージの最大サイズ (バイト単位) を取得または設定します。

MessageEncoding

SOAP メッセージのエンコードに MTOM または Text/XML のどちらを使用するかを取得または設定します。

MessageVersion

バインディングで構成されたクライアントとサービスによって使用されるメッセージ のバージョンを取得します。

(継承元 Binding)
Name

バインディングの名前を取得または設定します。

(継承元 Binding)
Namespace

バインディングの XML 名前空間を取得または設定します。

(継承元 Binding)
OpenTimeout

トランスポートが例外を発生させる前に、接続を開くために指定された時間の間隔を取得または設定します。

(継承元 Binding)
ProxyAddress

HTTP プロキシの URI アドレスを取得または設定します。

ReaderQuotas

このバインドで構成されたエンドポイントによって処理できる SOAP メッセージの複雑さに関する制約を取得または設定します。

ReceiveTimeout

接続が非アクティブのままで、アプリケーション メッセージを受信しない間に切断されるまでの時間を取得または設定します。

(継承元 Binding)
ReliableSession

システム提供のバインディングのいずれかを使用するときに使用できる、信頼できるセッション バインド要素のプロパティへの便利なアクセスを提供するオブジェクトを取得します。

Scheme

このバインディングで構成されているチャネルとリスナーの URI トランスポート スキームを取得します。

SendTimeout

トランスポートで例外が発生するまでの書き込み操作が完了するまでの指定時間を取得または設定します。

(継承元 Binding)
TextEncoding

メッセージ テキストに使用される文字エンコードを取得または設定します。

TransactionFlow

このバインドがフロー WS トランザクションをサポートする必要があるかどうかを示す値を取得または設定します。

UseDefaultWebProxy

システムの自動構成 HTTP プロキシを使用する必要があるかどうかを示す値を取得または設定します (使用可能な場合)。

メソッド

名前 説明
BuildChannelFactory<TChannel>(BindingParameterCollection)

指定した種類のチャネルを作成し、バインド パラメーターのコレクションで指定された機能を満たすチャネル ファクトリ スタックをクライアント上に構築します。

(継承元 Binding)
BuildChannelFactory<TChannel>(Object[])

指定した種類のチャネルを作成し、オブジェクト配列で指定された機能を満たすチャネル ファクトリ スタックをクライアント上に構築します。

(継承元 Binding)
BuildChannelListener<TChannel>(BindingParameterCollection)

指定した種類のチャネルを受け入れ、バインド パラメーターのコレクションで指定された機能を満たすチャネル リスナーをサービスに構築します。

(継承元 Binding)
BuildChannelListener<TChannel>(Object[])

指定した種類のチャネルを受け入れ、指定された機能を満たすチャネル リスナーをサービスに構築します。

(継承元 Binding)
BuildChannelListener<TChannel>(Uri, BindingParameterCollection)

指定した種類のチャネルを受け入れ、指定された機能を満たすチャネル リスナーをサービスに構築します。

(継承元 Binding)
BuildChannelListener<TChannel>(Uri, Object[])

指定した種類のチャネルを受け入れ、指定された機能を満たすチャネル リスナーをサービスに構築します。

(継承元 Binding)
BuildChannelListener<TChannel>(Uri, String, BindingParameterCollection)

指定した種類のチャネルを受け入れ、指定された機能を満たすチャネル リスナーをサービスに構築します。

(継承元 Binding)
BuildChannelListener<TChannel>(Uri, String, ListenUriMode, BindingParameterCollection)

指定した種類のチャネルを受け入れ、指定された機能を満たすチャネル リスナーをサービスに構築します。

(継承元 Binding)
BuildChannelListener<TChannel>(Uri, String, ListenUriMode, Object[])

指定した種類のチャネルを受け入れ、指定された機能を満たすチャネル リスナーをサービスに構築します。

(継承元 Binding)
BuildChannelListener<TChannel>(Uri, String, Object[])

指定した種類のチャネルを受け入れ、指定された機能を満たすチャネル リスナーをサービスに構築します。

(継承元 Binding)
CanBuildChannelFactory<TChannel>(BindingParameterCollection)

現在のバインディングが、指定されたバインド パラメーターのコレクションを満たすチャネル ファクトリ スタックをクライアント上に構築できるかどうかを示す値を返します。

(継承元 Binding)
CanBuildChannelFactory<TChannel>(Object[])

現在のバインディングが、オブジェクト配列で指定された要件を満たすチャネル ファクトリ スタックをクライアント上に構築できるかどうかを示す値を返します。

(継承元 Binding)
CanBuildChannelListener<TChannel>(BindingParameterCollection)

現在のバインディングが、指定されたバインド パラメーターのコレクションを満たすチャネル リスナー スタックをサービス上に構築できるかどうかを示す値を返します。

(継承元 Binding)
CanBuildChannelListener<TChannel>(Object[])

現在のバインディングが、オブジェクトの配列で指定された条件を満たすチャネル リスナー スタックをサービス上に構築できるかどうかを示す値を返します。

(継承元 Binding)
CreateBindingElements()

現在のバインディングに含まれるバインド要素の順序付けられたコレクションを返します。

CreateMessageSecurity()

派生クラスで実装されている場合は、現在のバインディングから SecurityBindingElement を返します。

Equals(Object)

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

(継承元 Object)
GetHashCode()

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

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

バインディング スタック内の適切なレイヤーから、要求された型指定されたオブジェクト (存在する場合) を返します。

(継承元 Binding)
GetTransport()

派生クラスで実装されている場合は、現在のバインディングからトランスポート バインド要素を返します。

GetType()

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

(継承元 Object)
MemberwiseClone()

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

(継承元 Object)
ShouldSerializeName()

バインディングの名前をシリアル化する必要があるかどうかを返します。

(継承元 Binding)
ShouldSerializeNamespace()

バインディングの名前空間をシリアル化する必要があるかどうかを返します。

(継承元 Binding)
ShouldSerializeReaderQuotas()

ReaderQuotas プロパティが既定値から変更され、シリアル化する必要があるかどうかを示す値を返します。

ShouldSerializeReliableSession()

ReliableSession プロパティが既定値から変更され、シリアル化する必要があるかどうかを示す値を返します。

ShouldSerializeTextEncoding()

TextEncoding プロパティが既定値から変更され、シリアル化する必要があるかどうかを示す値を返します。

ToString()

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

(継承元 Object)

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

名前 説明
IBindingRuntimePreferences.ReceiveSynchronously

受信要求が同期的または非同期的に処理されるかどうかを示す値を取得します。

適用対象