BasicHttpBinding クラス

定義

Windows Communication Foundation (WCF) サービスが、ASMX ベースの Web サービスおよびクライアント、および WS-I Basic Profile 1.1 に準拠する他のサービスと通信できるエンドポイントを構成および公開するために使用できるバインディングを表します。

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

次の例は、アプリケーション構成ファイルで BasicHttpBinding を構成する方法を示しています。

次の例は、 BasicHttpBindingをプログラムで構成する方法を示しています。

[ServiceContract(Namespace = "http://UE.ServiceModel.Samples")]
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);
}

public class CalculatorService : ICalculator
{
    public double Add(double n1, double n2)
    {
        double result = n1 + n2;
        Console.WriteLine("Received Add({0},{1})", n1, n2);
        Console.WriteLine("Return: {0}", result);
        return result;
    }

    public double Subtract(double n1, double n2)
    {
        double result = n1 - n2;
        Console.WriteLine("Received Subtract({0},{1})", n1, n2);
        Console.WriteLine("Return: {0}", result);
        return result;
    }

    public double Multiply(double n1, double n2)
    {
        double result = n1 * n2;
        Console.WriteLine("Received Multiply({0},{1})", n1, n2);
        Console.WriteLine("Return: {0}", result);
        return result;
    }

    public double Divide(double n1, double n2)
    {
        double result = n1 / n2;
        Console.WriteLine("Received Divide({0},{1})", n1, n2);
        Console.WriteLine("Return: {0}", result);
        return result;
    }

    public static void Main()
    {
        BasicHttpBinding binding = new BasicHttpBinding();
        binding.Name = "binding1";
        binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
        binding.Security.Mode = BasicHttpSecurityMode.None;

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

        // Create a ServiceHost for the CalculatorService type and provide the base address.
        ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

        serviceHost.AddServiceEndpoint(typeof(ICalculator), binding, address);

        // 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();

    }
}
   <ServiceContract(Namespace:="http://UE.ServiceModel.Samples")> _
   Public Interface ICalculator

       <OperationContract()> _
       Function Add(ByVal n1 As Double, ByVal n2 As Double) As Double
       <OperationContract()> _
       Function Subtract(ByVal n1 As Double, ByVal n2 As Double) As Double
       <OperationContract()> _
       Function Multiply(ByVal n1 As Double, ByVal n2 As Double) As Double
       <OperationContract()> _
       Function Divide(ByVal n1 As Double, ByVal n2 As Double) As Double
   End Interface

   ' Service class which implements the service contract.
   ' Added code to write output to the console window
   Public Class CalculatorService
       Implements ICalculator

       Public Function Add(ByVal n1 As Double, ByVal n2 As Double) As Double _
Implements ICalculator.Add

           Dim result As Double = n1 + n2
           Console.WriteLine("Received Add({0},{1})", n1, n2)
           Console.WriteLine("Return: {0}", result)
           Return result
       End Function

       Public Function Subtract(ByVal n1 As Double, ByVal n2 As Double) As Double _
Implements ICalculator.Subtract

           Dim result As Double = n1 - n2
           Console.WriteLine("Received Subtract({0},{1})", n1, n2)
           Console.WriteLine("Return: {0}", result)
           Return result
       End Function

       Public Function Multiply(ByVal n1 As Double, ByVal n2 As Double) As Double _
Implements ICalculator.Multiply

           Dim result As Double = n1 * n2
           Console.WriteLine("Received Multiply({0},{1})", n1, n2)
           Console.WriteLine("Return: {0}", result)
           Return result
       End Function

       Public Function Divide(ByVal n1 As Double, ByVal n2 As Double) As Double _
Implements ICalculator.Divide

           Dim result As Double = n1 / n2
           Console.WriteLine("Received Divide({0},{1})", n1, n2)
           Console.WriteLine("Return: {0}", result)
           Return result
       End Function

       Public Shared Sub Main()
           Dim binding As BasicHttpBinding = New BasicHttpBinding()
           binding.Name = "binding1"
           binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard
           binding.Security.Mode = BasicHttpSecurityMode.None

           Dim baseAddress As Uri = New Uri("http://localhost:8000/servicemodelsamples/service")
           Dim address As Uri = New Uri("http://localhost:8000/servicemodelsamples/service/calc")

           ' Create a ServiceHost for the CalculatorService type and provide the base address.
           Using serviceHost As ServiceHost = New ServiceHost(GetType(CalculatorService), baseAddress)

               serviceHost.AddServiceEndpoint(GetType(ICalculator), binding, address)

               ' Open the ServiceHost 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 ServiceHost to shutdown the service.
               serviceHost.Close()
           End Using
       End Sub
   End Class

注釈

BasicHttpBindingは、SOAP 1.1 メッセージを送信するためのトランスポートとして HTTP を使用します。 サービスはこのバインディングを使用して、ASMX クライアントがアクセスするエンドポイントなど、WS-I BP 1.1 に準拠するエンドポイントを公開できます。 同様に、クライアントは BasicHttpBinding を使用して、ASMX Web サービスや BasicHttpBinding で構成された Windows Communication Foundation (WCF) サービスなど、WS-I BP 1.1 に準拠するエンドポイントを公開するサービスと通信できます。

セキュリティは既定ではオフになっていますが、BasicHttpBinding(BasicHttpSecurityMode) コンストラクターでNone以外の値にBasicHttpSecurityModeを設定して追加できます。 既定では、"テキスト" メッセージ エンコードと UTF-8 テキスト エンコードが使用されます。

コンストラクター

名前 説明
BasicHttpBinding()

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

BasicHttpBinding(BasicHttpSecurityMode)

バインドで使用されるセキュリティの指定した型を使用して、 BasicHttpBinding クラスの新しいインスタンスを初期化します。

BasicHttpBinding(String)

構成名で指定されたバインディングを使用して、 BasicHttpBinding クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
AllowCookies

クライアントが Cookie を受け入れ、今後の要求に反映するかどうかを示す値を取得または設定します。

AllowCookies

クライアントが Cookie を受け入れ、今後の要求に反映するかどうかを示す値を取得または設定します。

(継承元 HttpBindingBase)
BypassProxyOnLocal

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

BypassProxyOnLocal

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

(継承元 HttpBindingBase)
CloseTimeout

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

(継承元 Binding)
EnableHttpCookieContainer
古い.

HTTP Cookie コンテナーが有効かどうかを示す値を取得または設定します。

EnvelopeVersion

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

EnvelopeVersion

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

(継承元 HttpBindingBase)
HostNameComparisonMode

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

HostNameComparisonMode

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

(継承元 HttpBindingBase)
MaxBufferPoolSize

チャネルからメッセージを受信するメッセージ バッファーのマネージャーが使用するために割り当てられるメモリの最大量 (バイト単位) を取得または設定します。

MaxBufferPoolSize

チャネルからメッセージを受信するメッセージ バッファーのマネージャーが使用するために割り当てられるメモリの最大量 (バイト単位) を取得または設定します。

(継承元 HttpBindingBase)
MaxBufferSize

チャネルからメッセージを受信するバッファーの最大サイズ (バイト単位) を取得または設定します。

MaxBufferSize

チャネルからメッセージを受信するバッファーの最大サイズ (バイト単位) を取得または設定します。

(継承元 HttpBindingBase)
MaxReceivedMessageSize

このバインディングで構成されたチャネルで受信できるメッセージの最大サイズ (バイト単位) を取得または設定します。

MaxReceivedMessageSize

このバインディングで構成されたチャネルで受信できるメッセージの最大サイズ (バイト単位) を取得または設定します。

(継承元 HttpBindingBase)
MessageEncoding

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

MessageVersion

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

(継承元 Binding)
Name

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

(継承元 Binding)
Namespace

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

(継承元 Binding)
OpenTimeout

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

(継承元 Binding)
ProxyAddress

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

ProxyAddress

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

(継承元 HttpBindingBase)
ReaderQuotas

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

ReaderQuotas

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

(継承元 HttpBindingBase)
ReceiveTimeout

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

(継承元 Binding)
Scheme

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

Scheme

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

(継承元 HttpBindingBase)
Security

このバインディングで使用されるセキュリティの種類を取得します。

SendTimeout

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

(継承元 Binding)
TextEncoding

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

TextEncoding

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

(継承元 HttpBindingBase)
TransferMode

メッセージがバッファーに送信されるかストリーミングされるかを示す値を取得または設定します。

TransferMode

メッセージがバッファーに送信されるかストリーミングされるかを示す値を取得または設定します。

(継承元 HttpBindingBase)
UseDefaultWebProxy

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

UseDefaultWebProxy

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

(継承元 HttpBindingBase)

メソッド

名前 説明
BuildChannelFactory<TChannel>(BindingParameterCollection)

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

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()

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

Equals(Object)

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

(継承元 Object)
GetHashCode()

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

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

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

(継承元 Binding)
GetType()

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

(継承元 Object)
MemberwiseClone()

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

(継承元 Object)
ShouldSerializeEnableHttpCookieContainer()

http Cookie コンテナーでシリアル化を有効にする必要があるかどうかを示します。

ShouldSerializeName()

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

(継承元 Binding)
ShouldSerializeNamespace()

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

(継承元 Binding)
ShouldSerializeReaderQuotas()

SOAP メッセージ構造の複雑さに置かれた制約値をシリアル化する必要があるかどうかを返します。

ShouldSerializeReaderQuotas()

SOAP メッセージ構造の複雑さに置かれた制約値をシリアル化する必要があるかどうかを返します。

(継承元 HttpBindingBase)
ShouldSerializeSecurity()

メッセージまたはトランスポート レベルなど、シリアル化が既に行われるかどうかに基づいてセキュリティ設定をシリアル化する必要があるかどうかを返します。

ShouldSerializeTextEncoding()

テキスト エンコードの設定をシリアル化する必要があるかどうかを返します。

ShouldSerializeTextEncoding()

テキスト エンコードの設定をシリアル化する必要があるかどうかを返します。

(継承元 HttpBindingBase)
ToString()

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

(継承元 Object)

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

名前 説明
IBindingRuntimePreferences.ReceiveSynchronously

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

IBindingRuntimePreferences.ReceiveSynchronously

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

(継承元 HttpBindingBase)

適用対象