Este artículo se tradujo automáticamente. Para ver el artículo en inglés, active la casilla Inglés. Además, puede mostrar el texto en inglés en una ventana emergente si mueve el puntero del mouse sobre el texto.
Traducción
Inglés

Enumeración ContextExchangeMechanism

 

Publicado: octubre de 2016

Especifica si el mecanismo utilizado para intercambiar contexto, en una conversación entre un cliente y servicio, es una cookie HTTP o un encabezado SOAP.

Espacio de nombres:   System.ServiceModel.Channels
Ensamblado:  System.ServiceModel (en System.ServiceModel.dll)

public enum ContextExchangeMechanism

Nombre de miembroDescripción
ContextSoapHeader

Se utiliza un encabezado SOAP para el intercambio de contexto. Éste es el mecanismo de intercambio predeterminado.

HttpCookie

Se utiliza una cookie HTTP para el intercambio de contexto.

Use the P:System.ServiceModel.Channels.ContextBindingElement.ContextExchangeMechanism property or the M:System.ServiceModel.Channels.ContextBindingElement.#ctor(System.Net.Security.ProtectionLevel,System.ServiceModel.Channels.ContextExchangeMechanism) constructor to specify the value of the T:System.ServiceModel.Channels.ContextExchangeMechanism for a conversation between a client and service.

Service endpoints that require support for the context exchange protocol can make this requirement explicit in their published policy. Policy assertions that represent the requirement for the client to support the context exchange protocol at the SOAP level or that require the enabling of HTTP cookie support can be published by an endpoint. The generation of these assertions into the policy on the service is controlled by the value of the P:System.ServiceModel.Channels.ContextBindingElement.ContextExchangeMechanism property as follows:

  • For F:System.ServiceModel.Channels.ContextExchangeMechanism.HttpCookie, the following assertion is generated:

    <HttpUseCookie xmlns=”http://schemas.xmlsoap.org/soap/http”/>
    
  • For F:System.ServiceModel.Channels.ContextExchangeMechanism.ContextSoapHeader, the following assertion is generated:

    <IncludeContext 
    xmlns=”http://schemas.microsoft.com/ws/2006/05/context”
    protectionLevel=”Sign” />
    

The F:System.ServiceModel.Channels.ContextExchangeMechanism.HttpCookie enumeration is implemented at the transport layer. This can be used in the case of simplex communication, where the client makes an initial request and the context is provided by the service on the corresponding reply. All subsequent messages between the service and client for the lifetime of that conversation contain the context. For service endpoints that use an HTTP transport and clients that agree to allow the use of HTTP cookies, the F:System.ServiceModel.Channels.ContextExchangeMechanism.HttpCookie enumeration can be utilized to exchange the application context. When HTTP cookies are used to propagate context, they should be protected using transport security. This mechanism cannot be used with non-HTTP transports.

The F:System.ServiceModel.Channels.ContextExchangeMechanism.ContextSoapHeader enumeration provides an alternative that is implemented in a custom context channel and that can be used with non-HTTP transports and other message exchange pattern, such as request-reply, and a duplex session. This context exchange protocol provides a SOAP-based equivalent of the feature offered by HTTP cookies at the transport layer. It introduces a new wsc:Context SOAP header to represent the context information. The wsc:Context header must be protected from modification while in transit for the same reason as the WS-Addressing headers must be protected: upon arrival, these headers are used to dispatch the message to the correct workflow instances. The wsc:Context header is therefore required to be digitally signed at either SOAP or transport level when the binding offers message protection capability.

The channel layer communicates the context to and from the application layer using T:System.ServiceModel.Channels.ContextMessageProperty.

.NET Framework
Disponible desde 3.5
Volver al principio
Mostrar: