<basicHttpBinding> の <message>

<<basicHttpBinding>>のメッセージ レベル セキュリティの設定を定義します。

<system.serviceModel>
  <bindings>
    <<basicHttpBinding>>
      <binding>
        <basicHttpBinding> の <security>
          <basicHttpBinding> の <message>

<message 
   algorithmSuite="Basic128/Basic192/Basic256/Basic128Rsa15/Basic256Rsa15/TripleDes/TripleDesRsa15/Basic128Sha256/Basic192Sha256/TripleDesSha256/Basic128Sha256Rsa15/Basic192Sha256Rsa15/Basic256Sha256Rsa15/TripleDesSha256Rsa15"
      clientCredentialType="UserName/Certificate"/>

属性および要素

属性

属性 説明

algorithmSuite

メッセージの暗号化とキー ラップ アルゴリズムを設定します。この属性は、アルゴリズムとキー サイズを指定する SecurityAlgorithmSuite 型です。これらのアルゴリズムは、Security Policy Language (WS-SecurityPolicy) の仕様で指定されているアルゴリズムに対応付けられています。

既定値は、Basic286 です。

clientCredentialType

メッセージ ベースのセキュリティを使用してクライアント認証を実行するときに使用される資格情報の種類を指定します。既定値は UserName です。

子要素

なし

親要素

要素 説明

<basicHttpBinding> の <security>

<<basicHttpBinding>>のセキュリティ機能を定義します。

このサンプルでは、basicHttpBinding とメッセージ セキュリティを使用するアプリケーションを実装する方法を示します。サービスの次の構成例では、エンドポイント定義によって basicHttpBinding が指定され、Binding1 という名前のバインディング構成が参照されます。サービスがクライアントに対してサービス自体を認証するために使用する証明書は、serviceCredentials 要素の下にある構成ファイルの behaviors セクションで設定されます。クライアントがサービスに対してクライアント自体を認証するために使用する証明書に適用される検証モードも、clientCertificate 要素の下にある behaviors セクションで設定されます。

同じバインディングとセキュリティの詳細が、クライアントの構成ファイルで指定されます。

<system.serviceModel>
    <services>
      <service name="Microsoft.ServiceModel.Samples.CalculatorService"
               behaviorConfiguration="CalculatorServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="https://localhost:8000/ServiceModelSamples/service"/>
          </baseAddresses>
        </host>
        <!-- this endpoint is exposed at the base address provided by host: https://localhost:8000/ServiceModelSamples/service  -->
        <endpoint address=""
                  binding="basicHttpBinding"
                  bindingConfiguration="Binding1" 
                  contract="Microsoft.ServiceModel.Samples.ICalculator" />
        <!-- the mex endpoint is exposed at https://localhost:8000/ServiceModelSamples/service/mex -->
        <endpoint address="mex"
                  binding="mexHttpBinding"
                  contract="IMetadataExchange" />
      </service>
    </services>

    <bindings>
      <basicHttpBinding>
        <!-- 
        This configuration defines the SecurityMode as Message and 
        the clientCredentialType as Certificate.
        -->
        <binding name="Binding1" >
          <security mode = "Message">
            <message clientCredentialType="Certificate"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>

    <!--For debugging purposes set the includeExceptionDetailInFaults attribute to true-->
    <behaviors>
      <serviceBehaviors>
        <behavior name="CalculatorServiceBehavior">
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="False" />
          <!--
        The serviceCredentials behavior allows one to define a service certificate.
        A service certificate is used by a client to authenticate the service and provide message protection.
        This configuration references the "localhost" certificate installed during the setup instructions.
        -->
          <serviceCredentials>
            <serviceCertificate findValue="localhost" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
            <clientCertificate>
              <!-- 
            Setting the certificateValidationMode to PeerOrChainTrust means that if the certificate 
            is in the user's Trusted People store, then it will be trusted without performing a
            validation of the certificate's issuer chain. This setting is used here for convenience so that the 
            sample can be run without having to have certificates issued by a certificate authority (CA).
            This setting is less secure than the default, ChainTrust. The security implications of this 
            setting should be carefully considered before using PeerOrChainTrust in production code. 
            -->
              <authentication certificateValidationMode="PeerOrChainTrust" />
            </clientCertificate>
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
</system.serviceModel>

関連項目

リファレンス

BasicHttpMessageSecurity
Message
Message
BasicHttpMessageSecurityElement

概念

<binding>

その他の技術情報

Securing Services and Clients
Windows Communication Foundation Bindings
Configuring System-Provided Bindings
Using Bindings to Configure Services and Clients