Diese Dokumentation wurde archiviert und wird nicht länger gepflegt.


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
public class HttpTransportBindingElement extends TransportBindingElement implements IWsdlExportExtension, IPolicyExportExtension
public class HttpTransportBindingElement extends TransportBindingElement implements IWsdlExportExtension, IPolicyExportExtension
Nicht zutreffend.

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 the 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 illustrates 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 containing 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");
    // Open the ServiceHostBase to create listeners and start listening for messages.

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

    // Close the ServiceHostBase to shutdown the service.

HttpTransportBindingElement may also be used in a configuration file as demonstrated in the following configuration:



<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"


proxyAuthenticationScheme="Anonymous" realm=""

useDefaultWebProxy="true" />




Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

Microsoft .NET Framework 3.0 wird unter Windows Vista, Microsoft Windows XP SP2 und Windows Server 2003 SP1 unterstützt.

.NET Framework

Unterstützt in: 3.0