Custom bindings provide full control over the WCF messaging stack. Special tailored bindings can be created my adding the configuration elements for specific entities. For example, the user can combine the httpsTransport section, reliableSession section and the securitysection to create a reliable and secure https based binding.An individual binding defines the message stack by specifying the configuration elements for the stack elements in the order they appear on the stack. Each element defines and configures the one element of the stack. There must be one and only one transport element in each custom binding. Without this element, the messaging stack is incomplete.The order in which elements appear in the stack matters, because it is the order in which operations are applied to the message. The recommended order of stack elements is the following:Transactions (optional)Reliable Messaging (optional)Security (optional)TransportEncoder (optional)Use a custom binding when one of the system-provided bindings does not meet the requirements of your service. A custom binding could be used, for example, to enable the use of a new transport or a new encoder at a service endpoint.A custom binding is constructed using one of the CustomBinding from a collection of binding elements that are "stacked" in a specific order:At the top is an optional
TransactionFlowBindingElement that allows flowing transactions.Next is an optional
ReliableSessionBindingElement that provides a session and ordering mechanism as defined in the WS-ReliableMessaging specification. This notion of a session can cross SOAP and transport intermediaries.Next is an optional security binding element that provides security features like authorization, authentication, protection, and confidentiality. The following security binding elements are provided by Windows Communication Foundation (WCF):
SecurityBindingElement AsymmetricSecurityBindingElement SymmetricSecurityBindingElement TransportSecurityBindingElement Next are the optional message-patterns specified by binding elements:
CompositeDuplexBindingElement Next are the optional transport upgrades/helpers binding elements:
PnrpPeerResolverBindingElement SslStreamSecurityBindingElement WindowsStreamSecurityBindingElement Next is a required message encoding binding element. You can use your own transport or use one of the following message encoding bindings:
TextMessageEncodingBindingElement BinaryMessageEncodingBindingElement MtomMessageEncodingBindingElement At the bottom is a required transport element. You can use your own transport or use one of transport binding elements provided by Windows Communication Foundation (WCF):
TcpTransportBindingElement NamedPipeTransportBindingElement HttpTransportBindingElement HttpsTransportBindingElement MsmqTransportBindingElement MsmqIntegrationBindingElement PeerTransportBindingElement The following table summarizes the options for each layer.LayerOptionsRequiredTransaction FlowTransactionFlowBindingElementNoReliabilityReliableSessionBindingElementNoSecuritySymmetric, Asymmetric, Transport-LevelNoShape ChangeCompositeDuplexBindingElementNoTransport UpgradesSSL stream, Windows stream, Peer ResolverNoEncodingText, Binary, MTOM, CustomYesTransportTCP, Named Pipes, HTTP, HTTPS, flavors of MSMQ, CustomYesIn addition, you can define your own binding elements and insert them between any of the preceding defined layers.For a discussion on how to use a custom binding to modify a system-provided binding, see
How To: Customize a System-Provided Binding.
Syntax
closeTimeout="TimeSpan"
openTimeout="TimeSpan"
receiveTimeout="TimeSpan"
sendTimeout="TimeSpan"
advancedFlowControl="Boolean"
bufferedMessagesQuota="Integer"
inactivityTimeout="TimeSpan"
maxPendingChannels="Integer"
maxRetryCount="Integer"
ordered="Boolean" />
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">
detectReplays="false"
maxCookieCachingTime="00:07:24" />
maxClockSkew="00:00:03"
replayWindow="00:07:22.2190000" />
maxWritePoolSize="Integer"
maxSessionSize="Integer" />
maxMessageSize="Integer"
authenticationScheme="Negotiate"
bypassProxyOnLocal="Boolean"
hostNameComparisonMode="Exact"
mapAddressingHeadersToHttpHeaders="Boolean"
proxyaddress="Uri"
realm="String"
requireClientCertificate="Boolean" />
maxMessageSize="20002"
listenIPAddress="202.10.1.9"
messageAuthentication="false"
peerNodeAuthenticationMode="None"
port="1000" />
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" >
detectReplays="Boolean"
replayCacheSize="Integer"
maxClockSkew="TimeSpan"
maxCookieCachingTime="TimeSpan"
replayWindow="TimeSpan"
sessionKeyRenewalInterval="TimeSpan"
sessionKeyRolloverInterval="TimeSpan"
reconnectOnTransportFailure="Boolean"
timestampValidityDuration="TimeSpan"
cookieRenewalThresholdPercentage="Integer" />
issuedCookieLifeTime="TimeSpan"
maxStatefulNegotiations="Integer"
replayCacheSize="Integer"
maxClockSkew="TimeSpan"
negotiationTimeout="TimeSpan"
replayWindow="TimeSpan"
inactivityTimeout="TimeSpan"
sessionKeyRenewalInterval="TimeSpan"
sessionKeyRolloverInterval="TimeSpan"
reconnectOnTransportFailure="Boolean"
maxConcurrentSessions="Integer"
timestampValidityDuration="TimeSpan" />
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" >
detectReplays="Boolean"
replayCacheSize="Integer"
maxClockSkew="TimeSpan"
maxCookieCachingTime="TimeSpan"
replayWindow="TimeSpan"
sessionKeyRenewalInterval="TimeSpan"
sessionKeyRolloverInterval="TimeSpan"
reconnectOnTransportFailure="Boolean"
timestampValidityDuration="TimeSpan"
cookieRenewalThresholdPercentage="Integer" />
issuedCookieLifeTime="TimeSpan"
maxStatefulNegotiations="Integer"
replayCacheSize="Integer"
maxClockSkew="TimeSpan"
negotiationTimeout="TimeSpan"
replayWindow="TimeSpan"
inactivityTimeout="TimeSpan"
sessionKeyRenewalInterval="TimeSpan"
sessionKeyRolloverInterval="TimeSpan"
reconnectOnTransportFailure="Boolean"
maxConcurrentSessions="Integer"
timestampValidityDuration="TimeSpan" />
keySize="Integer"
tokenType="String" />
bindingConfiguration="String"
binding="String" />
cacheIssuedTokens="Boolean"
maxIssuedTokenCachingTime="TimeSpan"
keyEntropyMode="ClientEntropy/ServerEntropy/CombinedEntropy" />
behaviorConfiguration="String" />
bindingConfiguration="String"
binding="String" />