ユーザーのメッセージング スタックを完全に制御します。
<configuration>
<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>
<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="SymmetricKey/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>
属性および要素
以降のセクションでは、属性、子要素、および親要素について説明します
Attributes
| 特性 | Description |
|---|---|
| closeTimeout | 閉じる操作が完了するまでに指定された時間間隔を指定する TimeSpan 値。 この値は、 Zero以上である必要があります。 既定値は 00:01:00 です。 |
| 名前 | バインディングの構成名を含む文字列。 この値は、カスタム バインディングの識別文字列として機能するユーザー定義文字列です。 .NET Framework 4 以降では、バインドと動作に名前を付ける必要はありません。 既定の構成と名前のないバインディングと動作の詳細については、「WCF サービスの 簡略化された構成 と 簡略化された構成」を参照してください。 |
| openTimeout | 開いている操作が完了するまでに指定された時間間隔を指定する TimeSpan 値。 この値は、 Zero以上である必要があります。 既定値は 00:01:00 です。 |
| receiveTimeout | 受信操作が完了するまでの時間間隔を指定する TimeSpan 値。 この値は、 Zero以上である必要があります。 既定値は 00:01:00 です。 |
| sendTimeout | 送信操作が完了するまでに指定された時間間隔を指定する TimeSpan 値。 この値は、 Zero以上である必要があります。 既定値は 00:01:00 です。 |
子要素
| 要素 | Description |
|---|---|
| <compositeDuplex> | カスタム バインディングへの双方向メッセージングを指定します。 HTTP など、双方向通信をネイティブに許可しないトランスポートで使用されます。 これに対し、TCP では双方向通信がネイティブに許可され、サービスがクライアントにメッセージを送信するためにこのバインディング要素を使用する必要はありません。 クライアントは、サービスが接続を確立し、接続を確立するためのアドレスを公開する必要があります。 このクライアント アドレスは、 ClientBaseAddress 属性によって提供されます。この要素は CompositeDuplexElement型です。 |
| <pnrpPeerResolver> | ピア名解決プロトコル (PNRP) ピア名リゾルバーを指定します。 この要素は PnrpPeerResolverElement型です。 |
| <reliableSession> | WS-Reliable メッセージングの設定を指定します。 この要素をカスタム バインドに追加すると、結果のチャネルで 1 回だけ配信保証をサポートできます。 この要素は ReliableSessionElement型です。 |
| <安全> | カスタム バインディングのセキュリティオプションを指定します。 この要素は SecurityElement型です。 |
| <sslStreamSecurity> | SSL ストリーム バインドのセキュリティ設定を指定します。 この要素は SslStreamSecurityElement型です。 |
| <transactionFlow> | バインディングがトランザクション フローと、 transactionProtocol 属性で使用されるプロトコルをサポートすることを指定します。 この要素は TransactionFlowElement型です。 |
| <windowsStreamSecurity> | カスタム バインディングのストリーミング セキュリティのオプションを指定します。 この要素は WindowsStreamSecurityElement型です。 |
親要素
| 要素 | Description |
|---|---|
| bindings | Windows Communication Foundation アプリケーションのすべてのバインドが含まれています。 |
注釈
カスタム バインドでは、WCF メッセージング スタックを完全に制御できます。 特定のエンティティの構成要素を追加することで、特別な調整されたバインドを作成できます。 たとえば、ユーザーは httpsTransport セクション、 reliableSession セクション、および security セクションを組み合わせて、信頼性の高い安全な https ベースのバインドを作成できます。
個々のバインドでは、スタック要素の構成要素をスタックに表示される順序で指定することで、メッセージ スタックを定義します。 各要素は、スタックの 1 つの要素を定義して構成します。 各カスタム バインドには、トランスポート要素が 1 つだけ存在する必要があります。 この要素がない場合、メッセージング スタックは不完全です。
要素がスタックに出現する順序は重要です。これは、メッセージに操作が適用される順序であるためです。 スタック要素の推奨順序は次のとおりです。
トランザクション (省略可能)
Reliable Messaging (省略可能)
セキュリティ (省略可能)
Transport
エンコーダー (省略可能)
システム提供のバインディングのいずれかがサービスの要件を満たしていない場合は、カスタム バインドを使用します。 たとえば、サービス エンドポイントで新しいトランスポートまたは新しいエンコーダーを使用できるようにするために、カスタム バインドを使用できます。
カスタム バインドは、特定の順序で "積み上げ" されているバインド要素のコレクションから CustomBinding のいずれかを使用して構築されます。
上部には、トランザクションのフローを許可する省略可能な TransactionFlowBindingElement があります。
次に、WS-ReliableMessaging 仕様で定義されているセッションと順序付けメカニズムを提供する省略可能な ReliableSessionBindingElement です。 セッションのこの概念は、SOAP とトランスポートの中継局をまたがる可能性があります。
次に、承認、認証、保護、機密性などのセキュリティ機能を提供するオプションのセキュリティ バインド要素です。 次のセキュリティ バインディング要素は、Windows Communication Foundation (WCF) によって提供されます。
次に、バインド要素によって指定される省略可能なメッセージ パターンを示します。
次に、オプションのトランスポート アップグレード/ヘルパー バインド要素を示します。
次に、必要なメッセージ エンコード バインド要素を示します。 独自のトランスポートを使用することも、次のいずれかのメッセージ エンコード バインドを使用することもできます。
下部には必須のトランスポート要素があります。 独自のトランスポートを使用することも、Windows Communication Foundation (WCF) によって提供されるトランスポート バインド要素のいずれかを使用することもできます。
次の表は、各レイヤーのオプションをまとめたものです。
| レイヤー | オプション | 必須 |
|---|---|---|
| トランザクション フロー | TransactionFlowBindingElement | いいえ |
| Reliability | ReliableSessionBindingElement | いいえ |
| セキュリティ | 対称、非対称、Transport-Level | いいえ |
| 図形の変更 | CompositeDuplexBindingElement | いいえ |
| トランスポートのアップグレード | SSL ストリーム、Windows ストリーム、ピア リゾルバー | いいえ |
| Encoding | Text、Binary、MTOM、Custom | イエス |
| Transport | TCP、名前付きパイプ、HTTP、HTTPS、MSMQ のフレーバー、カスタム | イエス |
さらに、独自のバインド要素を定義し、上記の定義済みのレイヤーの間に挿入することもできます。
カスタム バインドを使用してシステム提供のバインドを変更する方法については、「 方法: System-Provided バインドをカスタマイズする」を参照してください。
こちらも参照ください
.NET