You can use the CustomBinding class when one of the system-provided bindings does not meet the requirements of your service. All bindings are constructed from an ordered set of binding elements. Custom bindings can be built from a set of system-provided binding elements or can include user-defined custom binding elements. You can use custom binding elements, for example, to enable the use of new transports or encoders at a service endpoint. For working examples, see 657e8143-beb0-472d-9cfe-ed1a19c2ab08. For more information, see <customBinding>.
A custom binding is constructed using the CustomBinding constructor from a collection of binding elements that are "stacked" in a specific order:
At the top is an optional TransactionFlowBindingElement class that allows flowing transactions.
Next is an optional ReliableSessionBindingElement class that provides a session and ordering mechanisms as defined in the WS-ReliableMessaging specification. A session can cross SOAP and transport intermediaries.
Next is an optional SecurityBindingElement class that provides security features such as authorization, authentication, protection, and confidentiality.
Next is an optional CompositeDuplexBindingElement class that provides the ability to have two way duplex communication with a transport protocol that does not support duplex communication natively, such as HTTP.
Next is an optional OneWayBindingElement) class that provides one-way communication.
Next is an optional stream security binding element which can be one of the following.
Next is a required message encoding binding element. You can use your own message encoder or one of the three message encoding bindings:
At the bottom is a required transport element. You can use your own transport or one of the following transport binding elements Windows Communication Foundation (WCF) provides:
The following table summarizes the options for each layer.
Text, binary, Message Transmission Optimization Mechanism (MTOM), custom
TCP, HTTP, HTTPS, named pipes (also known as IPC), Peer-to-Peer (P2P), Message Queuing (also known as MSMQ), Custom
In addition, you can define your own binding elements and insert them between any of the preceding defined layers.