Condividi tramite


<basicHttpBinding> (Silverlight)

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

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.

Syntax

<basicHttpBinding>
   <binding 
       name="string"
       maxBufferSize="Integer" 
       maxReceivedMessageSize="Integer"        closeTimeout="TimeSpan"
       openTimeout="TimeSpan" 
       receiveTimeout="TimeSpan" 
       sendTimeout="TimeSpan" 
       textEncoding="UnicodeFffeTextEncoding/Utf16TextEncoding/Utf8TextEncoding"
       <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.

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 also is 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 name and namespace attributes 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. This value is not being respected in Silverlight 4 and setting it will not affect the behavior of the application.

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

  • UTF-8: 8-bit encoding.

The default is UTF8Encoding.

Child Elements

Element Description

<bindings> (Silverlight)

Optional. Specifies the security settings for a client configured with a basic binding that uses the HTTP transport.

Parent Elements

Element Description

<binding> of <basicHttpBinding> (Silverlight)

This element holds a collection of standard and custom bindings. Each entry is a binding element that can be identified uniquely by its name.

Remarks

The BasicHttpBinding uses HTTP as the transport for sending SOAP 1.1 messages. A client can use the BasicHttpBinding to communicate with services exposing 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 by 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 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.