次の方法で共有


<customBinding>

ユーザーのメッセージ スタックを完全に制御できます。

<system.serviceModel>
  <bindings>
    <customBinding>

<customBinding>
    <binding name="string"
        closeTimeout="TimeSpan"
        openTimeout="TimeSpan" 
        receiveTimeout="TimeSpan"
        sendTimeout="TimeSpan"
       <compositeDuplex clientBaseAddress="Uri"/>
       <reliableSession acknowledgementInterval="TimeSpan"
           advancedFlowControl="Boolean" 
           bufferedMessagesQuota="Integer"
           inactivityTimeout="TimeSpan"
           maxPendingChannels="Integer"
           maxRetryCount="Integer" 
           ordered="Boolean" />
       <pnrpPeerResolver />
       <windowsStreamSecurity protectionLevel="None/Sign/EncryptAndSign"/>
       <sslStreamSecurity requireClientCertificate="Boolean" />
              <transactionFlow transactionProtocol="OleTransactions/WSAtomicTransactionOctober2004"/>
       <security 
          defaultAlgorithmSuite="Basic128/Basic192/Basic256/Basic128Rsa15/ Basic256Rsa15/TripleDes/TripleDesRsa15/Basic128Sha256/Basic192Sha256/TripleDesSha256/Basic128Sha256Rsa15/Basic192Sha256Rsa15/Basic256Sha256Rsa15/TripleDesSha256Rsa15"
           authenticationMode="UserNameForAnonymous"
           contextMode="Cookie" 
           defaultProtectionLevel="Sign"
           enableKeyDerivation="false"
           keyEntropyMode="ClientEntropy" 
                  messageProtectionOrder="SignBeforeEncryptAndEncryptSignature" 
           securityVersion="WSSecurityXXX2005">
           <localClientSettings cacheCookies="false"
               detectReplays="false"
               maxCookieCachingTime="00:07:24" />
           <localServiceSettings replayCacheSize="9"
               maxClockSkew="00:00:03" 
               replayWindow="00:07:22.2190000" />
       </security>
       <binaryMessageEncoding maxReadPoolSize="Integer"
           maxWritePoolSize="Integer"
           maxSessionSize="Integer" />
       <httpsTransport manualAddressing="Boolean"
           maxMessageSize="Integer"
           authenticationScheme="Negotiate" 
           bypassProxyOnLocal="Boolean"
           hostNameComparisonMode="Exact" 
           mapAddressingHeadersToHttpHeaders="Boolean" 
           proxyaddress="Uri"
           realm="String" 
           requireClientCertificate="Boolean" />
       <peerTransport manualAddressing="false"
          maxMessageSize="20002"
          listenIPAddress="202.10.1.9" 
          messageAuthentication="false"
          peerNodeAuthenticationMode="None"
          port="1000" />

<security 
      defaultAlgorithmSuite="Basic128/Basic192/Basic256/Basic128Rsa15/ Basic256Rsa15/TripleDes/TripleDesRsa15/Basic128Sha256/Basic192Sha256/TripleDesSha256/Basic128Sha256Rsa15/Basic192Sha256Rsa15/Basic256Sha256Rsa15/TripleDesSha256Rsa15"
   authenticationMode="UserNameForAnonymous"
   bootstrapBindingConfiguration="String"
   bootstrapBindingSectionName="String"
   defaultProtectionLevel="None/Sign/EncryptAndSign"
      requireDerivedKeys="Boolean"
   securityHeaderLayout="Strict/Lax/LaxTimestampFirst/LaxTimestampLast"
   includeTimestamp="Boolean"
   keyEntropyMode="ClientEntropy/ServerEntropy/CombinedEntropy" 
   messageProtectionOrder="SignBeforeEncrypt/SignBeforeEncryptAndEncryptSignature/EncryptBeforeSign" 
   protectTokens="Boolean"
   requireSecurityContextCancellation="Boolean"
   securityVersion=" WSSecurityJan2004/WSSecurityXXX2005"
   requireSignatureConfirmation="Boolean" >
   <localClientSettings cacheCookies="Boolean"
      detectReplays="Boolean"
      replayCacheSize="Integer"
      maxClockSkew="TimeSpan"
      maxCookieCachingTime="TimeSpan"
      replayWindow="TimeSpan"
      sessionKeyRenewalInterval="TimeSpan"
      sessionKeyRolloverInterval="TimeSpan"
      reconnectOnTransportFailure="Boolean"
      timestampValidityDuration="TimeSpan"
      cookieRenewalThresholdPercentage="Integer" />
   <localServiceSettings detectReplays="Boolean"
      issuedCookieLifeTime="TimeSpan"
      maxStatefulNegotiations="Integer"
            replayCacheSize="Integer"
      maxClockSkew="TimeSpan" 
      negotiationTimeout="TimeSpan"
      replayWindow="TimeSpan"
      inactivityTimeout="TimeSpan"
      sessionKeyRenewalInterval="TimeSpan"
      sessionKeyRolloverInterval="TimeSpan"
      reconnectOnTransportFailure="Boolean"
      maxConcurrentSessions="Integer"
      timestampValidityDuration="TimeSpan" />
   <federationParameters trustVersion="WSTrustApr2004/WSTrustFeb2005" />
<security 
   defaultAlgorithmSuite="Basic128/Basic192/Basic256/Basic128Rsa15/ Basic256Rsa15/TripleDes/TripleDesRsa15/Basic128Sha256/Basic192Sha256/TripleDesSha256/Basic128Sha256Rsa15/Basic192Sha256Rsa15/Basic256Sha256Rsa15/TripleDesSha256Rsa15"
   authenticationMode="UserNameForAnonymous"
   bootstrapBindingConfiguration="String"
   bootstrapBindingSectionName="String"
   defaultProtectionLevel="None/Sign/EncryptAndSign"
      requireDerivedKeys="Boolean"
   securityHeaderLayout="Strict/Lax/LaxTimestampFirst/LaxTimestampLast"
   includeTimestamp="Boolean"
   keyEntropyMode="ClientEntropy/ServerEntropy/CombinedEntropy" 
   messageProtectionOrder="SignBeforeEncrypt/SignBeforeEncryptAndEncryptSignature/EncryptBeforeSign" 
   protectTokens="Boolean"
   requireSecurityContextCancellation="Boolean"
   securityVersion=" WSSecurityJan2004/WSSecurityXXX2005"
   requireSignatureConfirmation="Boolean" >
   <localClientSettings cacheCookies="Boolean"
      detectReplays="Boolean"
      replayCacheSize="Integer"
      maxClockSkew="TimeSpan"
      maxCookieCachingTime="TimeSpan"
      replayWindow="TimeSpan"
      sessionKeyRenewalInterval="TimeSpan"
      sessionKeyRolloverInterval="TimeSpan"
      reconnectOnTransportFailure="Boolean"
      timestampValidityDuration="TimeSpan"
      cookieRenewalThresholdPercentage="Integer" />
   <localServiceSettings detectReplays="Boolean"
      issuedCookieLifeTime="TimeSpan"
      maxStatefulNegotiations="Integer"
            replayCacheSize="Integer"
      maxClockSkew="TimeSpan" 
      negotiationTimeout="TimeSpan"
      replayWindow="TimeSpan"
      inactivityTimeout="TimeSpan"
      sessionKeyRenewalInterval="TimeSpan"
      sessionKeyRolloverInterval="TimeSpan"
      reconnectOnTransportFailure="Boolean"
      maxConcurrentSessions="Integer"
      timestampValidityDuration="TimeSpan" />
   <federationParameters trustVersion="WSTrustApr2004/WSTrustFeb2005" />
   <GenericIssuedTokenParameters> 
      <LocalIssuerIssuedTokenParameters keyType=" SymmeticKey/PublicKey"
        keySize="Integer"
        tokenType="String" />
     <IssuedTokenParametersEndpointAddress address="URI"
        bindingConfiguration="String"
        binding="String" />
     <IssuedTokenClient localIssuerChannelBehaviors="String"
        cacheIssuedTokens="Boolean"
        maxIssuedTokenCachingTime="TimeSpan"
        keyEntropyMode="ClientEntropy/ServerEntropy/CombinedEntropy" />
     <IssuedTokenClientBehavior issuerAddress="String"
        behaviorConfiguration="String" />
     <IssuedTokenClientBehavior address="URI"
        bindingConfiguration="String"
        binding="String" />
   </GenericIssuedTokenParameters> 
</security>
</binding>
</customBinding>

属性および要素

属性

属性 説明

closeTimeout

クローズ操作が完了するまでの期間を指定する TimeSpan 値。この値は必ず Zero 以上である必要があります。既定値は 00:01:00 です。

name

バインディングの設定名を格納する文字列です。この値は、カスタム バインディングの識別文字列として機能するユーザー定義文字列です。

openTimeout

実行中の操作が完了するまでの時間間隔を指定する TimeSpan 値です。この値は必ず Zero 以上である必要があります。既定値は 00:01:00 です。

receiveTimeout

受信操作が完了するまでの時間間隔を指定する TimeSpan 値です。この値は必ず Zero 以上である必要があります。既定値は 00:01:00 です。

sendTimeout

送信操作が完了するまでの時間間隔を指定する TimeSpan 値です。この値は必ず Zero 以上である必要があります。既定値は 00:01:00 です。

子要素

要素 説明

<compositeDuplex>

カスタム バインディングの双方向のメッセージングを指定します。たとえば HTTP のように、ネイティブでの二重通信を許可しないトランスポートで使用されます。これとは対照的に、TCP では、二重通信がネイティブで許可されているので、クライアントにメッセージを返信するためにこのバインディング要素をサービスで使用する必要はありません。

クライアントは、サービスのアドレスを公開して、アクセスおよび接続の確立ができるようにする必要があります。このクライアント アドレスは、ClientBaseAddress 属性によって提供されます。

この要素は CompositeDuplexElement 型です。

<pnrpPeerResolver>

PNRP (Peer Name Resolution Protocol) ピア名リゾルバを指定します。この要素は PnrpPeerResolverElement 型です。

<reliableSession>

WS-ReliableMessaging の設定を指定します。この要素がカスタム バインディングに追加される場合、その結果となるチャネルにより、正確に 1 回の配信保証をサポートできます。この要素は ReliableSessionElement 型です。

<customBinding> の <security>

カスタム バインディングのセキュリティ オプションを指定します。この要素は SecurityElement 型です。

<sslStreamSecurity>

SSL ストリーム バインディングのセキュリティ設定を指定します。この要素は SslStreamSecurityElement 型です。

<transactionFlow>

バインディングがトランザクション フローをサポートし、プロトコルがtransactionProtocol 属性によって使用される必要があることを指定します。この要素は TransactionFlowElement 型です。

<windowsStreamSecurity>

カスタム バインディングのストリーミング セキュリティのオプションを指定します。この要素は WindowsStreamSecurityElement 型です。

親要素

要素 説明

バインディング

Windows Communication Foundation アプリケーションのすべてのバインディングを含みます。

解説

カスタム バインディングを使用すると、WCF メッセージ スタックのフル コントロールが可能になります。特定のエンティティの構成要素を追加した、特別にカスタマイズされたバインディングを作成できます。たとえば、ユーザーは httpsTransport セクション、reliableSession セクション、および security セクションを組み合わせて、信頼できるセキュリティで保護された HTTPS ベースのバインディングを作成できます。

個別のバインディングは、メッセージ スタックを、スタック要素の構成要素をスタックに出現する順序で指定することにより定義します。各要素は、スタック内の 1 つの要素を定義および構成します。各カスタム バインディング内のトランスポート要素は 1 つだけにする必要があります。この要素がない場合、メッセージ スタックは不完全です。

要素がスタックに出現する順序は重要です。それは、その順序で操作がメッセージに適用されるためです。スタック要素で推奨される順序を次に示します。

  1. トランザクション (省略可能)
  2. 信頼できるメッセージ機能 (省略可能)
  3. セキュリティ (省略可能)
  4. トランスポート
  5. エンコーダ (省略可能)

システムが提供するバインディングの中にサービスの要件を満たすものがない場合は、カスタム バインディングを使用します。たとえば、カスタム バインディングを使用すると、サービス エンドポイントで新しいトランスポートや新しいエンコーダを使用できます。

カスタム バインディングは、特定の順序で "積み重ねられている" バインディング要素のコレクションから CustomBinding の 1 つを使用して作成します。

各層のオプションの概要を次の表に示します。

オプション 必須

トランザクション フロー

TransactionFlowBindingElement

×

信頼性

ReliableSessionBindingElement

×

セキュリティ

同期、非同期、トランスポート レベル

×

形状の変更

CompositeDuplexBindingElement

×

トランスポートのアップグレード

SSL ストリーム、Windows ストリーム、ピア リゾルバ

×

エンコーディング

テキスト、バイナリ、MTOM、カスタム

トランスポート

TCP、名前付きパイプ、HTTP、HTTPS、MSMQ のフレーバー、カスタム

さらに、独自のバインディング要素を定義し、それを定義済みの層のいずれかの間に挿入できます。

カスタム バインディングを使用してシステム標準のバインディングを変更する方法については、「How To: Customize a System-Provided Binding」を参照してください。

1.

関連項目

リファレンス

<customBinding>
Binding
BindingElement
BindingsSection
CustomBinding

概念

<binding>

その他の技術情報

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