次の方法で共有


<binding> of <customBinding> (Silverlight)

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

Use the binding element of the customBinding element to configure Silverlight client communications with services that expose endpoints that do not conform to WS-I BP 1.1 or when you want full control over the message stack.

Syntax

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

Attributes and Elements

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

Attributes

Attribute Description

name

Required string attribute. 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.

closeTimeout

Optional TimeSpan attribute. 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.

openTimeout

Optional TimeSpan attribute. 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

Optional TimeSpan attribute. 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

Optional TimeSpan attribute. 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

<binaryMessageEncoding> (Silverlight)

This element configures a binary message encoder that encodes Silverlight messages in binary on the wire that is compatible with the Windows Communication Foundation (WCF) binary message encoder.

<httpCookieContainer> (Silverlight)

This element enables you to manage how HTTP cookies are handled in HTTP requests and responses.

<httpTransport> (Silverlight)

This element configures the maximum buffer size and the maximum received message size for the HTTP transport.

<httpsTransport> (Silverlight)

This element configures the maximum buffer size and the maximum received message size for the HTTPS transport.

<pollingDuplex> (Silverlight)

This element configures polling duplex communication between a service and a client.

<security> of <customBinding> (Silverlight)

This element configures security settings of the local client that use a custom binding and the values it uses for initiating a secure conversation with a service.

<textMessageEncoding> (Silverlight)

This element specifies the type of character encoding and the SOAP message version used for the text-based XML messages.

<tcpTransport> of <customBinding> (Silverlight)

This element configures the attributes for the TCP transport.

Parent Elements

Element Description

<customBinding> (Silverlight)

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

Text Value

Remarks

Custom bindings provide full control over the Silverlight messaging stack. Special tailored bindings can be created by 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 (Required).

  3. Security (Optional).

Example

The following example demonstrates how to configure a customized binding.

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

See Also

Reference

CustomBinding
Binding
BindingElement