Custom Bindings


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 Custom Binding Samples. 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 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.

EncodingText, binary, Message Transmission Optimization Mechanism (MTOM), customYes
TransportTCP, HTTP, HTTPS, named pipes (also known as IPC), Peer-to-Peer (P2P), Message Queuing (also known as MSMQ), CustomYes

In addition, you can define your own binding elements and insert them between any of the preceding defined layers.

Endpoint Creation Overview
Using Bindings to Configure Services and Clients
System-Provided Bindings
How to: Customize a System-Provided Binding
Custom Binding