<binding> of <basicHttpBinding> (Silverlight)

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

You can use the binding element of the basicHttpBinding element to configure Silverlight client communications with services that expose endpoints that conform to WS-I BP 1.1, such as ASMX Web services or services.

Syntax

<basicHttpBinding>
   <binding 
       closeTimeout="TimeSpan"        enableHttpCookieContainer="Boolean"
       maxBufferSize="Integer" 
       maxReceivedMessageSize="Integer" 
       name=”string” 
       openTimeout="TimeSpan" 
       receiveTimeout="TimeSpan" 
       sendTimeout="TimeSpan" 
       textEncoding="UnicodeFffeTextEncoding/Utf16TextEncoding/Utf8TextEncoding">       transferMode="Buffered/StreamedResponse">
       <security mode="None/Transport/TransportWithMessageCredential/TransportCredentialOnly" >
       </security>
   </binding>
</basicHttpBinding>

Attributes and Elements

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

Attributes

Attribute Description

closeTimeout

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

enableHttpCookieContainer

Optional Boolean value that specifies whether or not the BasicHttpBinding will include the HttpCookieContainerBindingElement. The default value is false.

maxBufferSize

Optional integer value that specifies the maximum size, in bytes, of a buffer that stores messages while they are processed for an endpoint configured with this binding. The default value is 2147483647 bytes, and this is also the largest value allowed.

maxReceivedMessageSize

Optional positive integer that defines the maximum message size, in bytes, including headers, for a message that can be received on a channel configured with this binding. The sender receives a SOAP fault if the message is too large for the receiver. The default is 2147483647 bytes. The largest value allowed is 9223372036854775807 bytes.

name

Required string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Each binding has a name and namespace attribute that together uniquely identify it in the metadata of the service. In addition, this name is unique among bindings of the same type.

openTimeout

Optional 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 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:10:00.

sendTimeout

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

textEncoding

Optional value sets the character set encoding to be used for emitting messages on the binding. Valid values include the following:

  • BigEndianUnicode: Unicode BigEndian encoding.

  • Unicode: 16-bit encoding.

  • UTF8: 8-bit encoding

transferMode

Optional value that indicates whether messages are sent buffered or streamed.

Child Elements

Element Description

<security> of <basicHttpBinding> (Silverlight)

Optional. Defines the security settings for the binding. This element is of type BasicHttpSecurityElement.

Parent Elements

Element Description

<basicHttpBinding> (Silverlight)

Required. Represents a binding that a Silverlight client can use to configure and expose endpoints that are able to communicate with ASMX-based Web services and other services that conform to the WS-I Basic Profile 1.1.

Remarks

The BasicHttpBinding uses HTTP as the transport for sending SOAP 1.1 messages. A client can use the BasicHttpBinding to communicate with services that expose endpoints that conform to WS-I BP 1.1, such as ASMX Web services or services configured with the BasicHttpBinding.

Security is turned off by default, but can be added setting the mode attribute of the <security> of <basicHttpBinding> (Silverlight) child element to a value other than None. It uses a "Text" message encoding and UTF-8 text encoding by default.

Example

The following code sample shows how to configure a system-provided binding of type BasicHttpBinding using configuration.

<system.serviceModel> 
  <bindings>
     <basicHttpBinding>
        <binding name="SilverlightBinding1" 
                 receiveTimeout="00:10:00"
                 sendTimeout="00:01:00"
                 openTimeout="00:01:00"
                 closeTimeout="00:01:00"
                 maxReceivedMessageSize="2147483647" 
                 maxBufferSize="2147483647" 
                 textEncoding="Utf-8" >
             <security mode="None" />
         </binding>
     </basicHttpBinding>
  </bindings>
</system.serviceModel>

The values set in this code sample are the default values.