Questo articolo è stato tradotto automaticamente. Per visualizzare l'articolo in inglese, selezionare la casella di controllo Inglese. È possibile anche visualizzare il testo inglese in una finestra popup posizionando il puntatore del mouse sopra il testo.
Traduzione
Inglese

Enumerazione ContextExchangeMechanism

 

Data di pubblicazione: ottobre 2016

Specifica se un cookie HTTP o un'intestazione SOAP è il meccanismo utilizzato per lo scambio del contesto per una conversazione tra un client e un servizio.

Spazio dei nomi:   System.ServiceModel.Channels
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public enum ContextExchangeMechanism

Nome membroDescrizione
ContextSoapHeader

Un'intestazione SOAP viene utilizzata per lo scambio del contesto. Questo è il meccanismo di scambio predefinito.

HttpCookie

Un cookie HTTP viene utilizzato per lo scambio del contesto.

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
Disponibile da 3.5
Torna all'inizio
Mostra: