Context Bindings
With .NET 3.5, WCF gained three additional bindings dedicated to managing custom
contexts. These bindings, found in the System.WorkflowServices.dll assembly, are the BasicHttpContextBinding
, the NetTcpContextBinding
, and the WSHttpContextBinding
. The context bindings all derive from their respective
regular bindings:
public class BasicHttpContextBinding : BasicHttpBinding { /* Same constructors as BasicHttpBinding */ } public class NetTcpContextBinding : NetTcpBinding { /* Same constructors as NetTcpBinding */ public ProtectionLevel ContextProtectionLevel {get;set;} } public class WSHttpContextBinding : WSHttpBinding { /* Same constructors as WSHttpBinding */ public ProtectionLevel ContextProtectionLevel {get;set;} }
In the case of the NetTcpContextBinding
and the
WSHttpContextBinding
, the ContextProtectionLevel
indicates how to protect the context while in transfer,
as discussed in Chapter 10.
The context bindings are used exactly the same way as their base bindings, yet they add support for a dedicated context management protocol. These bindings can be used with or without a context. The context protocol lets you pass as a custom context a collection of strings in the form of pairs of keys and values, stored implicitly in the message headers. There are several important differences between using a context binding and using the direct message headers for passing out-of-band parameters to a custom context:
With a context binding, you can only set the information to ...
Get Programming WCF Services, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.