CustomBinding Class
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Defines a binding from a list of binding elements.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
The CustomBinding type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | CustomBinding() | Initializes a new instance of the CustomBinding class. |
![]() | CustomBinding(Binding) | Initializes a new instance of the CustomBinding class from the values of a specified binding. |
![]() | CustomBinding(array<BindingElement>) | Initializes a new instance of the CustomBinding class from an array of binding elements. |
![]() | CustomBinding(IEnumerable<BindingElement>) | Initializes a new instance of the CustomBinding class with the binding elements from a complete channel stack. |
![]() | CustomBinding(String, String, array<BindingElement>) | Initializes a new instance of the CustomBinding class from an array of binding elements with a specified name and namespace. |
| Name | Description | |
|---|---|---|
![]() | CloseTimeout | Gets or sets the interval of time provided for a connection to close before the transport raises an exception. (Inherited from Binding.) |
![]() | Elements | Gets the binding elements from the custom binding. |
![]() | MessageVersion | Gets the message version used by clients and services configured with the binding. (Inherited from Binding.) |
![]() | Name | Gets or sets the name of the binding. (Inherited from Binding.) |
![]() | Namespace | Gets or sets the XML namespace of the binding. (Inherited from Binding.) |
![]() | OpenTimeout | Gets or sets the interval of time provided for a connection to open before the transport raises an exception. (Inherited from Binding.) |
![]() | ReceiveTimeout | Gets or sets the interval of time that a connection can remain inactive, during which no application messages are received, before it is dropped. (Inherited from Binding.) |
![]() | Scheme | Gets the URI scheme for transport used by the custom binding. (Overrides Binding::Scheme.) |
![]() | SendTimeout | Gets or sets the interval of time provided for a write operation to complete before the transport raises an exception. (Inherited from Binding.) |
| Name | Description | |
|---|---|---|
![]() | BuildChannelFactory<TChannel>(BindingParameterCollection) | Builds the channel factory stack on the client that creates a specified type of channel and that satisfies the features specified by a collection of binding parameters. (Inherited from Binding.) |
![]() | BuildChannelFactory<TChannel>(array<Object>) | Builds the channel factory stack on the client that creates a specified type of channel and that satisfies the features specified by an object array. (Inherited from Binding.) |
![]() | CanBuildChannelFactory<TChannel>(BindingParameterCollection) | Returns a value that indicates whether the current binding can build a channel factory stack on the client that satisfies the collection of binding parameters specified. (Inherited from Binding.) |
![]() | CanBuildChannelFactory<TChannel>(array<Object>) | Returns a value that indicates whether the current binding can build a channel factory stack on the client that satisfies the requirements specified by an object array. (Inherited from Binding.) |
![]() | CreateBindingElements | Returns a generic collection of the binding elements from the custom binding. (Overrides Binding::CreateBindingElements().) |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetProperty<T> | Returns a typed object requested, if present, from the appropriate layer in the binding stack. (Inherited from Binding.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
Use a custom binding when one of the system-provided bindings does not meet the requirements of your client. A custom binding could be used, for example, to enable the use of a new encoder to access 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 bottom of this stack are the binding elements that specify the message encoder and the transport:
At the bottom is a required transport element. You can use your own transport or use one of the HTTP transport binding elements provided by Windows Phone:
Next is a required message encoding binding element. You can use your own transport or use one of the following message encoding bindings:
The following table summarizes the options for each layer.
Layer | Options | Required |
|---|---|---|
Encoding | Text, Custom | Yes |
Transport | HTTP, HTTPS, Custom | Yes |


