Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

HttpTransportBindingElement Class

Represents the binding element used to specify an HTTP transport for transmitting messages.

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

public class HttpTransportBindingElement : TransportBindingElement, 
	IWsdlExportExtension, IPolicyExportExtension

The HttpTransportBindingElement type exposes the following members.

  NameDescription
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsHttpTransportBindingElement()Initializes a new instance of the HttpTransportBindingElement class.
Protected methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsHttpTransportBindingElement(HttpTransportBindingElement)Initializes a new instance of the HttpTransportBindingElement class using another binding element.
Top

  NameDescription
Public propertySupported in .NET for Windows Store appsAllowCookiesGets or sets a value that indicates whether the client accepts cookies and propagates them on future requests.
Public propertySupported in .NET for Windows Store appsAuthenticationSchemeGets or sets the authentication scheme used to authenticate client requests being processed by an HTTP listener.
Public propertyBypassProxyOnLocalGets or sets a value that indicates whether proxies are ignored for local addresses.
Public propertyDecompressionEnabledGets or sets whether the process for returning compressed message data to its original size and format is enabled.
Public propertyExtendedProtectionPolicyGets or sets the value of the extended security policy used by the server to validate incoming client connections.
Public propertyHostNameComparisonModeGets or sets a value that indicates whether the hostname is used to reach the service when matching on the URI.
Public propertyKeepAliveEnabledGets or sets a value that indicates whether to make a persistent connection to a service endpoint.
Public propertySupported by Portable Class LibrarySupported in .NET for Windows Store appsManualAddressingGets or sets a value that indicates whether manual addressing of the message is required. (Inherited from TransportBindingElement.)
Public propertyMaxBufferPoolSizeGets or sets the maximum size, in bytes, of any buffer pools used by the transport. (Inherited from TransportBindingElement.)
Public propertySupported by Portable Class LibrarySupported in .NET for Windows Store appsMaxBufferSizeGets or sets the maximum size of the buffer to use. For buffered messages this value is the same as MaxReceivedMessageSize. For streamed messages, this value is the maximum size of the SOAP headers, which must be read in buffered mode.
Public propertyMaxPendingAcceptsGets or sets the maximum number of connections the service can accept simultaneously.
Public propertySupported by Portable Class LibrarySupported in .NET for Windows Store appsMaxReceivedMessageSizeGets and sets the maximum allowable message size, in bytes, that can be received. (Inherited from TransportBindingElement.)
Public propertyMessageHandlerFactoryGets or sets the Http transport message handler factory.
Public propertyProxyAddressGets or sets a URI that contains the address of the proxy to use for HTTP requests.
Public propertyProxyAuthenticationSchemeGets or sets the authentication scheme used to authenticate client requests being processed by an HTTP proxy.
Public propertyRealmGets or sets the authentication realm.
Public propertyRequestInitializationTimeoutGets or sets the requested initialization time out.
Public propertySupported by Portable Class LibrarySupported in .NET for Windows Store appsSchemeGets the URI scheme for the transport. (Overrides TransportBindingElement.Scheme.)
Public propertySupported in .NET for Windows Store appsTransferModeGets or sets the transfer mode.
Public propertyUnsafeConnectionNtlmAuthenticationGets or sets a value that indicates whether Unsafe Connection Sharing is enabled on the server. If enabled, NTLM authentication is performed once on each TCP connection.
Public propertyUseDefaultWebProxyGets or sets a value that indicates whether the machine-wide proxy settings are used rather than the user specific settings.
Public propertySupported in .NET for Windows Store appsWebSocketSettingsGets or sets the web socket configuration of the binding element.
Top

  NameDescription
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsBuildChannelFactory<TChannel>Creates a channel factory that can be used to create a channel. (Overrides BindingElement.BuildChannelFactory<TChannel>(BindingContext).)
Public methodBuildChannelListener<TChannel>Creates a channel listener of the specified type. (Overrides BindingElement.BuildChannelListener<TChannel>(BindingContext).)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsCanBuildChannelFactory<TChannel>Determines whether a channel factory of the specified type can be built. (Overrides BindingElement.CanBuildChannelFactory<TChannel>(BindingContext).)
Public methodCanBuildChannelListener<TChannel>Determines whether a channel listener of the specified type can be built. (Overrides BindingElement.CanBuildChannelListener<TChannel>(BindingContext).)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsCloneCreates a new instance that is a copy of the current binding element. (Overrides BindingElement.Clone().)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsGetProperty<T>Gets a property from the specified BindingContext. (Overrides TransportBindingElement.GetProperty<T>(BindingContext).)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodShouldSerializeExtendedProtectionPolicyReturns a valueindicating that it is not possible to XAML serialize the extended protection policy.
Public methodShouldSerializeMessageHandlerFactoryDetermines whether the message handler factory should be serialized.
Public methodShouldSerializeWebSocketSettingsDetermines whether the web socket settings should be serialized.
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsToStringReturns a string that represents the current object. (Inherited from Object.)
Protected methodUpdateAuthenticationSchemesUpdates the transport authentication schemes that contains the binding context.
Top

  NameDescription
Explicit interface implemetationPrivate methodIPolicyExportExtension.ExportPolicyExports a custom policy assertion about bindings.
Explicit interface implemetationPrivate methodIWsdlExportExtension.ExportContractWrites custom Web Services Description Language (WSDL) elements into the generated WSDL for a contract.
Explicit interface implemetationPrivate methodIWsdlExportExtension.ExportEndpointWrites custom Web Services Description Language (WSDL) elements into the generated WSDL for an endpoint.
Top

The HttpTransportBindingElement class is the starting point for creating a custom binding that implements the HTTP transport protocol. HTTP is the primary transport used for interoperability purposes. This transport is supported by Windows Communication Foundation (WCF) to ensure interoperability with other non-WCF Web services stacks.

The WCF service model uses this class to create factory objects that implement the IChannelFactory and IChannelListener interfaces. These factory objects, in turn, create the channels and listeners that transmit SOAP messages using the HTTP protocol.

You configure the factories that this class creates by setting its properties, such as AuthenticationScheme, HostNameComparisonMode, and MaxBufferSize.

You can also set properties on the base class, TransportBindingElement, such as ManualAddressing, MaxReceivedMessageSize, and MaxBufferPoolSize. For a complete list of properties, see TransportBindingElement.

The following code shows how to imperatively use the HttpTransportBindingElement.

Uri baseAddress = new Uri("http://localhost:8000/servicemodelsamples/service");

// Create a ServiceHost for the CalculatorService type and provide the base address. 
using (ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress))
{
    // Create a custom binding that contains two binding elements.
    ReliableSessionBindingElement reliableSession = new ReliableSessionBindingElement();
    reliableSession.Ordered = true;

    HttpTransportBindingElement httpTransport = new HttpTransportBindingElement();
    httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous;
    httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;

    CustomBinding binding = new CustomBinding(reliableSession, httpTransport);

    // Add an endpoint using that binding.
    serviceHost.AddServiceEndpoint(typeof(ICalculator), binding, "");

    // Add a MEX endpoint.
    ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
    smb.HttpGetEnabled = true;
    smb.HttpGetUrl = new Uri("http://localhost:8001/servicemodelsamples");
    serviceHost.Description.Behaviors.Add(smb);

    // Open the ServiceHostBase to create listeners and start listening for messages.
    serviceHost.Open();

    // The service can now be accessed.
    Console.WriteLine("The service is ready.");
    Console.WriteLine("Press <ENTER> to terminate service.");
    Console.WriteLine();
    Console.ReadLine();

    // Close the ServiceHostBase to shutdown the service.
    serviceHost.Close();
}

HttpTransportBindingElement can also be used in a configuration file as shown in the following configuration.

<bindings>
  <customBinding>
    <binding name="Binding1">
      <reliableSession acknowledgementInterval="00:00:00.2000000" enableFlowControl="true"
                        maxTransferWindowSize="32" inactivityTimeout="00:10:00" maxPendingChannels="128"
                        maxRetryCount="8" ordered="true" />
      <security mode="None"/>
      <httpTransport authenticationScheme="Anonymous" bypassProxyOnLocal="false"
                    hostNameComparisonMode="StrongWildcard" 
                    proxyAuthenticationScheme="Anonymous" realm="" 
                    useDefaultWebProxy="true" />
    </binding>
  </customBinding>
</bindings>

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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