Export (0) Print
Expand All

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.

System.Object
  System.ServiceModel.Channels.Binding
    System.ServiceModel.BasicHttpBinding

Namespace:  System.ServiceModel
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public class BasicHttpBinding : Binding

The BasicHttpBinding type exposes the following members.

  NameDescription
Public methodSupported by Silverlight for Windows PhoneBasicHttpBinding()Initializes a new instance of the BasicHttpBinding class.
Public methodSupported by Silverlight for Windows PhoneBasicHttpBinding(BasicHttpSecurityMode)Initializes a new instance of the BasicHttpBinding class with a specified type of security used by the binding.
Top

  NameDescription
Public propertySupported by Silverlight for Windows PhoneCloseTimeoutGets or sets the interval of time provided for a connection to close before the transport raises an exception. (Inherited from Binding.)
Public propertySupported by Silverlight for Windows PhoneEnableHttpCookieContainerGets or sets a value that indicates whether the [T:P:System.ServiceModel.BasicHttpBinding] will include the HttpCookieContainerBindingElement.
Public propertySupported by Silverlight for Windows PhoneEnvelopeVersionGets the version of SOAP that is used for messages that are processed by this binding.
Public propertySupported by Silverlight for Windows PhoneMaxBufferSizeGets or sets the maximum size for a buffer that receives messages from the channel.
Public propertySupported by Silverlight for Windows PhoneMaxReceivedMessageSizeGets or sets the maximum size for a message that can be received on a channel configured with this binding.
Public propertySupported by Silverlight for Windows PhoneMessageVersionGets the message version used by clients and services configured with the binding. (Inherited from Binding.)
Public propertySupported by Silverlight for Windows PhoneNameGets or sets the name of the binding. (Inherited from Binding.)
Public propertySupported by Silverlight for Windows PhoneNamespaceGets or sets the XML namespace of the binding. (Inherited from Binding.)
Public propertySupported by Silverlight for Windows PhoneOpenTimeoutGets or sets the interval of time provided for a connection to open before the transport raises an exception. (Inherited from Binding.)
Public propertySupported by Silverlight for Windows PhoneReceiveTimeoutGets 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.)
Public propertySupported by Silverlight for Windows PhoneSchemeGets the URI transport scheme for the channels and listeners that are configured with this binding. (Overrides Binding.Scheme.)
Public propertySupported by Silverlight for Windows PhoneSecurityGets the type of security used with this binding.
Public propertySupported by Silverlight for Windows PhoneSendTimeoutGets or sets the interval of time provided for a write operation to complete before the transport raises an exception. (Inherited from Binding.)
Public propertySupported by Silverlight for Windows PhoneTextEncodingGets or sets the character encoding that is used for the message text.
Public propertyTransferModeGets or sets a value that indicates whether messages are sent buffered or streamed.
Top

  NameDescription
Public methodSupported by Silverlight for Windows PhoneBuildChannelFactory<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.)
Public methodSupported by Silverlight for Windows PhoneBuildChannelFactory<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.)
Public methodSupported by Silverlight for Windows PhoneCanBuildChannelFactory<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.)
Public methodSupported by Silverlight for Windows PhoneCanBuildChannelFactory<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.)
Public methodSupported by Silverlight for Windows PhoneCreateBindingElementsReturns an ordered collection of binding elements contained in the current binding. (Overrides Binding.CreateBindingElements().)
Public methodSupported by Silverlight for Windows PhoneEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetProperty<T>Returns a typed object requested, if present, from the appropriate layer in the binding stack. (Inherited from Binding.)
Public methodSupported by Silverlight for Windows PhoneGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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();



Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft