Share via


<customBinding> (Silverlight)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

This element contains a collection of customized binding elements and provides full control over the messaging stack for a Silverlight application.

Syntax

  <customBinding>
    <binding 
        name="string"
        closeTimeout="TimeSpan"
        openTimeout="TimeSpan" 
        receiveTimeout="TimeSpan"
        sendTimeout="TimeSpan">
       <binaryMessageEncoding />
       <httpTransport
           maxBufferSize="Integer"
           maxReceivedMessageSize="long" />
       <httpsTransport
           maxBufferSize="Integer"
           maxReceivedMessageSize="long">
       </httpsTransport>
       <security authenticationMode="string " />
       <textMessageEncoding
           messageVersion="string"
           writeEncoding="string" />
    </binding>
  </customBinding>

Attributes and Elements

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

Attributes

None.

Child Elements

Element Description

<binding> of <customBinding> (Silverlight)

This element contains a custom binding for Silverlight application.

Parent Elements

Element Description

<bindings> (Silverlight)

This element contains the collection of custom bindings for a Silverlight application. Each binding in the collection is identified by its unique name attribute.

Text Value

Remarks

Custom bindings provide full control over the Silverlight 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 and the security section to create a 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 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. Encoder (Optional).

  2. Transport.

  3. Security (Optional).

Example

The following example demonstrates how to configure a custom binding.

<configuration>
  <system.serviceModel>
    <bindings>
      <!-- configure a custom binding -->
      <customBinding>
        <binding name="CustomBinding1"
                 closeTimeout="00:05:00" >
          <httpTransport maxBufferSize="400000" />
          <security authenticationMode="UserNameOverTransport" />
        </binding>
      </customBinding>
    </bindings>
  </system.serviceModel>
</configuration>

See Also

Reference

CustomBinding
Binding
BindingElement