BasicHttpBinding Class
Represents a binding that a Silverlight 5 client can use to configure endpoints that can communicate with ASMX-based Web services and other services that conform to the WS-I Basic Profile 1.1.
Namespace: System.ServiceModel
Assembly: System.ServiceModel (in System.ServiceModel.dll)
The BasicHttpBinding type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | BasicHttpBinding() | Initializes a new instance of the BasicHttpBinding class. |
![]() ![]() | BasicHttpBinding(BasicHttpSecurityMode) | Initializes a new instance of the BasicHttpBinding class with a specified type of security used by the binding. |
| 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.) |
![]() ![]() | EnableHttpCookieContainer | Gets or sets a value that indicates whether the [T:P:System.ServiceModel.BasicHttpBinding] will include the HttpCookieContainerBindingElement. |
![]() ![]() | EnvelopeVersion | Gets the version of SOAP that is used for messages that are processed by this binding. |
![]() ![]() | MaxBufferSize | Gets or sets the maximum size for a buffer that receives messages from the channel. |
![]() ![]() | MaxReceivedMessageSize | Gets or sets the maximum size for a message that can be received on a channel configured with this 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 transport scheme for the channels and listeners that are configured with this binding. (Overrides Binding.Scheme.) |
![]() ![]() | Security | Gets the type of security used with this binding. |
![]() ![]() | SendTimeout | Gets or sets the interval of time provided for a write operation to complete before the transport raises an exception. (Inherited from Binding.) |
![]() ![]() | TextEncoding | Gets or sets the character encoding that is used for the message text. |
![]() | TransferMode | Gets or sets a value that indicates whether messages are sent buffered or streamed. |
| 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>(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>(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 an ordered collection of binding elements contained in the current 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.) |
The BasicHttpBinding uses HTTP as the transport for sending SOAP 1.1 messages. A service can use this binding to expose endpoints that conform to WS-I BP 1.1, such as those that ASMX clients access. Similarly, 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 Windows Communication Foundation (WCF) services configured with the BasicHttpBinding.
Security is turned off by default, but can be added by setting the BasicHttpSecurityMode to a value other than None in the BasicHttpBinding(BasicHttpSecurityMode) constructor. It uses a "Text" message encoding and UTF-8 text encoding by default.
BasicHttpBinding binding = new BasicHttpBinding();
BasicHttpBinding transportSecurityBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
EnvelopeVersion envelopeVersion = binding.EnvelopeVersion;
//Output of TxtEV to TextBlock: Soap11 (http://schemas.xmlsoap.org/soap/evelope/)
string TxtEV = envelopeVersion.ToString();
// Get default MaxBufferSize
int maxBufferSize = binding.MaxBufferSize;
//Output of txtMBS to TextBlock: 65536
string txtMBS = maxBufferSize.ToString();
// Set new MaxBufferSize
binding.MaxReceivedMessageSize = 4096;
string txtNewMBS = binding.MaxReceivedMessageSize.ToString();
// Get default MaxReceivedMessageSize
long maxReceivedBufferSize = binding.MaxReceivedMessageSize;
//Output of txtMBS: 65536
string txtMRBS = maxReceivedBufferSize.ToString();
// Set new MaxReceivedMessageSize
binding.MaxReceivedMessageSize = 4096;
string txtNewMRBS = binding.MaxReceivedMessageSize.ToString();
// Get Scheme value
// Output of txtScheme: http
string txtScheme = binding.Scheme;
BasicHttpBinding bDefaultHttpBinding = new BasicHttpBinding();
//Output txtSecurityMode: None
string txtDefaultSecurityMode = bDefaultHttpBinding.Security.Mode.ToString();
BasicHttpBinding bTHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
//Output txtSecurityMode: Transport
string txtTSecurityMode = bTHttpBinding.Security.Mode.ToString();
BasicHttpBinding bTOHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
//Output txtSecurityMode: TransportCredentialOnly
string txtTOSecurityMode = bTOHttpBinding.Security.Mode.ToString();
//Gets the character encoding for the binding
Encoding encoding = binding.TextEncoding;
//Output txtEncoding: System.Text.UTF8Encoding
string txtEncoding = encoding.ToString();
Encoding unicodeEncoding = new UnicodeEncoding();
//Set a Unicode encoding for the binding
binding.TextEncoding = unicodeEncoding;
//Output txtEncoding: System.Text.UnicodeEncoding
string txtUEncoding = binding.TextEncoding.ToString();
BasicHttpBinding basicEHBinding = new BasicHttpBinding();
BindingElementCollection bindingEC = basicEHBinding.CreateBindingElements();
//Check on binding elements contained in the collection
bool boolHTBE = bindingEC.Contains(typeof(HttpTransportBindingElement));
//Returns true
string txtboolHTBE = boolHTBE.ToString();
bool boolHSTBE = bindingEC.Contains(typeof(HttpsTransportBindingElement));
//Returns false
string txtboolHSTBE = boolHSTBE.ToString();
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.



