Bagikan melalui


<customBinding>

Provides full control over the messaging stack for the user.

Schema Hierarchy

<system.serviceModel>
  <bindings>
    <customBinding>

Syntax

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

Attributes and Elements

The following sections describe attributes, child elements, and parent elements

Attributes

Attribute Description

closeTimeout

A TimeSpan value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to Zero. The default is 00:01:00.

name

A string that contains the configuration name of the binding. This value is a user-defined string that acts as the identification string for the custom binding.

openTimeout

A TimeSpan value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to Zero. The default is 00:01:00.

receiveTimeout

A TimeSpan value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to Zero. The default is 00:01:00.

sendTimeout

A TimeSpan value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to Zero. The default is 00:01:00.

Child Elements

Element Description

<compositeDuplex>

Specifies two-way messaging to the custom binding. It is used with transports that do not allow duplex communications natively, for example, HTTP. TCP, by contrast, allows duplex communications natively, and does not require the use of this binding element for the service to send messages back to a client.

The client must expose an address for the service to make contact and establish a connection. This client address is provided by the ClientBaseAddress attribute.

This element is of type CompositeDuplexElement.

<pnrpPeerResolver>

Specifies a Peer Name Resolution Protocol (PNRP) peer name resolver. This element is of type PnrpPeerResolverElement.

<reliableSession>

Specifies the setting for WS-Reliable Messaging. When this element is added to a custom binding, the resulting channel can support exactly-once delivery assurances. This element is of type ReliableSessionElement.

<security> of <customBinding>

Specifies the options for security of the custom binding. This element is of type SecurityElement.

<sslStreamSecurity>

Specifies the security settings for a SSL stream binding. This element is of type SslStreamSecurityElement.

<transactionFlow>

Specifies that the binding supports transaction flow, and the protocol to be used by the transactionProtocol attribute. This element is of type TransactionFlowElement.

<windowsStreamSecurity>

Specifies the options for streaming security of the custom binding. This element is of type WindowsStreamSecurityElement.

Parent Elements

Element Description

bindings

Contains all bindings for Windows Communication Foundation applications.

Remarks

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 security section 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:

  1. Transactions (optional)

  2. Reliable Messaging (optional)

  3. Security (optional)

  4. Transport

  5. Encoder (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:

The following table summarizes the options for each layer.

Layer Options Required

Transaction Flow

TransactionFlowBindingElement

No

Reliability

ReliableSessionBindingElement

No

Security

Symmetric, Asymmetric, Transport-Level

No

Shape Change

CompositeDuplexBindingElement

No

Transport Upgrades

SSL stream, Windows stream, Peer Resolver

No

Encoding

Text, Binary, MTOM, Custom

Yes

Transport

TCP, Named Pipes, HTTP, HTTPS, flavors of MSMQ, Custom

Yes

In 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.

1.

See Also

Reference

<customBinding>
Binding
BindingElement
BindingsSection
CustomBinding

Concepts

<binding>

Other Resources

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


© 2007 Microsoft Corporation. All rights reserved.
Last Published: 2010-01-05