HttpTransportBindingElement HttpTransportBindingElement HttpTransportBindingElement HttpTransportBindingElement Class

Definición

Representa el elemento de enlace utilizado para especificar un transporte HTTP para transmitir mensajes.Represents the binding element used to specify an HTTP transport for transmitting messages.

public ref class HttpTransportBindingElement : System::ServiceModel::Channels::TransportBindingElement, System::ServiceModel::Description::IPolicyExportExtension, System::ServiceModel::Description::IWsdlExportExtension
public class HttpTransportBindingElement : System.ServiceModel.Channels.TransportBindingElement, System.ServiceModel.Description.IPolicyExportExtension, System.ServiceModel.Description.IWsdlExportExtension
type HttpTransportBindingElement = class
    inherit TransportBindingElement
    interface IPolicyExportExtension
    interface IWsdlExportExtension
Public Class HttpTransportBindingElement
Inherits TransportBindingElement
Implements IPolicyExportExtension, IWsdlExportExtension
Herencia
Derivado
Implementaciones

Ejemplos

El código siguiente muestra cómo utilizar HttpTransportBindingElement imperativamente.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();
}
Dim baseAddress As New Uri("http://localhost:8000/servicemodelsamples/service")

' Create a ServiceHost for the CalculatorService type and provide the base address.
Using serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)
	' Create a custom binding that contains two binding elements.
	Dim reliableSession As New ReliableSessionBindingElement()
	reliableSession.Ordered = True

	Dim httpTransport As New HttpTransportBindingElement()
	httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous
	httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard

	Dim binding As New CustomBinding(reliableSession, httpTransport)

	' Add an endpoint using that binding.
	serviceHost.AddServiceEndpoint(GetType(ICalculator), binding, "")

	' Add a MEX endpoint.
	Dim smb As 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()
End Using

HttpTransportBindingElement también se puede utilizar en un archivo de configuración como se muestra en la configuración siguiente.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>  

Comentarios

La clase HttpTransportBindingElement es el punto inicial para crear un enlace personalizado que implementa el protocolo de transporte HTTP.The HttpTransportBindingElement class is the starting point for creating a custom binding that implements the HTTP transport protocol. HTTP es el transporte primario utilizado para fines de interoperabilidad.HTTP is the primary transport used for interoperability purposes. Windows Communication Foundation (WCF) admite este transporte para garantizar la interoperabilidad con otras pilas de servicios web que no son de WCF.This transport is supported by Windows Communication Foundation (WCF) to ensure interoperability with other non-WCF Web services stacks.

El modelo de servicio WCF utiliza esta clase para crear objetos de generador que IChannelFactory implementan las interfaces y IChannelListener .The WCF service model uses this class to create factory objects that implement the IChannelFactory and IChannelListener interfaces. Estos objetos de generador a su vez crean los canales y las escuchas que transmiten mensajes SOAP mediante el protocolo HTTP.These factory objects, in turn, create the channels and listeners that transmit SOAP messages using the HTTP protocol.

Puede configurar los generadores que esta clase crea estableciendo sus propiedades, como: AuthenticationScheme, HostNameComparisonMode y MaxBufferSize.You configure the factories that this class creates by setting its properties, such as AuthenticationScheme, HostNameComparisonMode, and MaxBufferSize.

También puede establecer las propiedades en la clase base TransportBindingElement, como ManualAddressing, MaxReceivedMessageSize y MaxBufferPoolSize.You can also set properties on the base class, TransportBindingElement, such as ManualAddressing, MaxReceivedMessageSize, and MaxBufferPoolSize. Para obtener una lista de propiedades completa, vea TransportBindingElement.For a complete list of properties, see TransportBindingElement.

Constructores

HttpTransportBindingElement() HttpTransportBindingElement() HttpTransportBindingElement() HttpTransportBindingElement()

Inicializa una nueva instancia de la clase HttpTransportBindingElement.Initializes a new instance of the HttpTransportBindingElement class.

HttpTransportBindingElement(HttpTransportBindingElement) HttpTransportBindingElement(HttpTransportBindingElement) HttpTransportBindingElement(HttpTransportBindingElement) HttpTransportBindingElement(HttpTransportBindingElement)

Inicializa una nueva instancia de la clase HttpTransportBindingElement usando otro elemento de enlace.Initializes a new instance of the HttpTransportBindingElement class using another binding element.

Propiedades

AllowCookies AllowCookies AllowCookies AllowCookies

Obtiene o establece un valor que indica si el cliente acepta las cookies y las propaga en solicitudes futuras.Gets or sets a value that indicates whether the client accepts cookies and propagates them on future requests.

AuthenticationScheme AuthenticationScheme AuthenticationScheme AuthenticationScheme

Obtiene o establece el esquema de autenticación usado para autenticar solicitudes de cliente que son procesadas por un agente de escucha HTTP.Gets or sets the authentication scheme used to authenticate client requests being processed by an HTTP listener.

BypassProxyOnLocal BypassProxyOnLocal BypassProxyOnLocal BypassProxyOnLocal

Obtiene o establece un valor que indica si los proxys se omiten para las direcciones locales.Gets or sets a value that indicates whether proxies are ignored for local addresses.

DecompressionEnabled DecompressionEnabled DecompressionEnabled DecompressionEnabled

Obtiene o establece si está habilitado el proceso de recuperación del tamaño y formato originales de los datos comprimidos del mensaje.Gets or sets whether the process for returning compressed message data to its original size and format is enabled.

ExtendedProtectionPolicy ExtendedProtectionPolicy ExtendedProtectionPolicy ExtendedProtectionPolicy

Obtiene o establece el valor de la directiva de seguridad extendida que usa el servidor para validar las conexiones de cliente entrantes.Gets or sets the value of the extended security policy used by the server to validate incoming client connections.

HostNameComparisonMode HostNameComparisonMode HostNameComparisonMode HostNameComparisonMode

Obtiene o establece un valor que indica si el nombre del host se usa para alcanzar el servicio al coincidir con el URI.Gets or sets a value that indicates whether the hostname is used to reach the service when matching on the URI.

KeepAliveEnabled KeepAliveEnabled KeepAliveEnabled KeepAliveEnabled

Obtiene o establece un valor que indica si realizar una conexión persistente a un extremo de servicio.Gets or sets a value that indicates whether to make a persistent connection to a service endpoint.

LegacyExtendedProtectionPolicy LegacyExtendedProtectionPolicy LegacyExtendedProtectionPolicy LegacyExtendedProtectionPolicy
ManualAddressing ManualAddressing ManualAddressing ManualAddressing

Obtiene o establece un valor que indica si se requiere la dirección manual del mensaje.Gets or sets a value that indicates whether manual addressing of the message is required.

(Inherited from TransportBindingElement)
MaxBufferPoolSize MaxBufferPoolSize MaxBufferPoolSize MaxBufferPoolSize

Obtiene o establece el tamaño máximo, en bytes, de cualquier grupo de búferes utilizado por el transporte.Gets or sets the maximum size, in bytes, of any buffer pools used by the transport.

(Inherited from TransportBindingElement)
MaxBufferSize MaxBufferSize MaxBufferSize MaxBufferSize

Obtiene o establece el tamaño máximo del búfer que se va a usar.Gets or sets the maximum size of the buffer to use. Para los mensajes almacenados en búfer este valor es el mismo que MaxReceivedMessageSize.For buffered messages this value is the same as MaxReceivedMessageSize. Para los mensajes transmitidos por secuencias, este valor tiene el tamaño máximo de los encabezados SOAP, que se deben leer en modo de almacenamiento en búfer.For streamed messages, this value is the maximum size of the SOAP headers, which must be read in buffered mode.

MaxPendingAccepts MaxPendingAccepts MaxPendingAccepts MaxPendingAccepts

Obtiene o establece el número máximo de conexiones que el servicio puede aceptar simultáneamente.Gets or sets the maximum number of connections the service can accept simultaneously.

MaxReceivedMessageSize MaxReceivedMessageSize MaxReceivedMessageSize MaxReceivedMessageSize

Obtiene o establece el tamaño máximo permitido del mensaje, en bytes, que se puede recibir.Gets or sets the maximum allowable message size, in bytes, that can be received.

(Inherited from TransportBindingElement)
MessageHandlerFactory MessageHandlerFactory MessageHandlerFactory MessageHandlerFactory

Obtiene o establece el generador de controladores de mensajes de transporte HTTP.Gets or sets the Http transport message handler factory.

ProxyAddress ProxyAddress ProxyAddress ProxyAddress

Obtiene o establece un URI que contiene la dirección del proxy que se va a usar para las solicitudes HTTP.Gets or sets a URI that contains the address of the proxy to use for HTTP requests.

ProxyAuthenticationScheme ProxyAuthenticationScheme ProxyAuthenticationScheme ProxyAuthenticationScheme

Obtiene o establece el esquema de autenticación usado para autenticar solicitudes de cliente que son procesadas por un proxy HTTP.Gets or sets the authentication scheme used to authenticate client requests being processed by an HTTP proxy.

Realm Realm Realm Realm

Obtiene o establece el dominio de autenticación.Gets or sets the authentication realm.

RequestInitializationTimeout RequestInitializationTimeout RequestInitializationTimeout RequestInitializationTimeout

Obtiene o establece el tiempo de espera de inicialización solicitada.Gets or sets the requested initialization time out.

Scheme Scheme Scheme Scheme

Obtiene el esquema URI para el transporte.Gets the URI scheme for the transport.

TransferMode TransferMode TransferMode TransferMode

Obtiene o establece el modo de transferencia.Gets or sets the transfer mode.

UnsafeConnectionNtlmAuthentication UnsafeConnectionNtlmAuthentication UnsafeConnectionNtlmAuthentication UnsafeConnectionNtlmAuthentication

Obtiene o establece un valor que indica si la conexión compartida no segura está habilitada en el servidor.Gets or sets a value that indicates whether Unsafe Connection Sharing is enabled on the server. Si está habilitado, la autenticación NTLM se realiza una vez en cada conexión TCP.If enabled, NTLM authentication is performed once on each TCP connection.

UseDefaultWebProxy UseDefaultWebProxy UseDefaultWebProxy UseDefaultWebProxy

Obtiene o establece un valor que indica si se usa la configuración del proxy de la máquina en lugar de la configuración específica del usuario.Gets or sets a value that indicates whether the machine-wide proxy settings are used rather than the user specific settings.

WebSocketSettings WebSocketSettings WebSocketSettings WebSocketSettings

Obtiene o establece la configuración de socket web del elemento de enlace.Gets or sets the web socket configuration of the binding element.

Métodos

BuildChannelFactory<TChannel>(BindingContext) BuildChannelFactory<TChannel>(BindingContext) BuildChannelFactory<TChannel>(BindingContext) BuildChannelFactory<TChannel>(BindingContext)

Crea un generador del canal que se puede utilizar para crear un canal.Creates a channel factory that can be used to create a channel.

BuildChannelListener<TChannel>(BindingContext) BuildChannelListener<TChannel>(BindingContext) BuildChannelListener<TChannel>(BindingContext) BuildChannelListener<TChannel>(BindingContext)

Crea un agente de escucha del canal del tipo especificado.Creates a channel listener of the specified type.

CanBuildChannelFactory<TChannel>(BindingContext) CanBuildChannelFactory<TChannel>(BindingContext) CanBuildChannelFactory<TChannel>(BindingContext) CanBuildChannelFactory<TChannel>(BindingContext)

Determina si se puede crear un generador de canales del tipo especificado.Determines whether a channel factory of the specified type can be built.

CanBuildChannelListener<TChannel>(BindingContext) CanBuildChannelListener<TChannel>(BindingContext) CanBuildChannelListener<TChannel>(BindingContext) CanBuildChannelListener<TChannel>(BindingContext)

Determina si se puede crear una escucha de canales del tipo especificado.Determines whether a channel listener of the specified type can be built.

Clone() Clone() Clone() Clone()

Crea una nueva instancia que es una copia del elemento de enlace actual.Creates a new instance that is a copy of the current binding element.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina si el objeto especificado es igual al objeto actual.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Sirve como la función hash predeterminada.Serves as the default hash function.

(Inherited from Object)
GetProperty<T>(BindingContext) GetProperty<T>(BindingContext) GetProperty<T>(BindingContext) GetProperty<T>(BindingContext)

Obtiene una propiedad a partir de BindingContext especificado.Gets a property from the specified BindingContext.

GetType() GetType() GetType() GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crea una copia superficial del objeto Object actual.Creates a shallow copy of the current Object.

(Inherited from Object)
ShouldSerializeExtendedProtectionPolicy() ShouldSerializeExtendedProtectionPolicy() ShouldSerializeExtendedProtectionPolicy() ShouldSerializeExtendedProtectionPolicy()

Devuelve un valor que indica que no se puede serializar en XAML la directiva de protección extendida.Returns a valueindicating that it is not possible to XAML serialize the extended protection policy.

ShouldSerializeMessageHandlerFactory() ShouldSerializeMessageHandlerFactory() ShouldSerializeMessageHandlerFactory() ShouldSerializeMessageHandlerFactory()

Determina si el generador de controladores de mensajes debe serializarse.Determines whether the message handler factory should be serialized.

ShouldSerializeWebSocketSettings() ShouldSerializeWebSocketSettings() ShouldSerializeWebSocketSettings() ShouldSerializeWebSocketSettings()

Determina si la configuración de socket web debe serializarse.Determines whether the web socket settings should be serialized.

ToString() ToString() ToString() ToString()

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Inherited from Object)
UpdateAuthenticationSchemes(BindingContext) UpdateAuthenticationSchemes(BindingContext) UpdateAuthenticationSchemes(BindingContext) UpdateAuthenticationSchemes(BindingContext)

Actualiza los esquemas de autenticación de transporte que contiene el contexto de enlace.Updates the transport authentication schemes that contains the binding context.

Implementaciones de interfaz explícitas

IPolicyExportExtension.ExportPolicy(MetadataExporter, PolicyConversionContext) IPolicyExportExtension.ExportPolicy(MetadataExporter, PolicyConversionContext) IPolicyExportExtension.ExportPolicy(MetadataExporter, PolicyConversionContext) IPolicyExportExtension.ExportPolicy(MetadataExporter, PolicyConversionContext)

Exporta una aserción de directiva personalizada sobre los enlaces.Exports a custom policy assertion about bindings.

IWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext) IWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext) IWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext) IWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext)

Escribe los elementos del Lenguaje de descripción de servicios Web (WSDL) personalizados en el WSDL generado para un contrato.Writes custom Web Services Description Language (WSDL) elements into the generated WSDL for a contract.

IWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext) IWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext) IWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext) IWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext)

Escribe los elementos del Lenguaje de descripción de servicios Web (WSDL) personalizados en el WSDL generado para un extremo.Writes custom Web Services Description Language (WSDL) elements into the generated WSDL for an endpoint.

Se aplica a