IContextManager 接口 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
定义一个允许在通道上获取和设置上下文的接口。
public interface class IContextManager
	public interface IContextManager
	type IContextManager = interface
	Public Interface IContextManager
	注解
如果通道使用的 WSHttpContextBinding 已设置 NotAllowed 值,则在客户端上使用 IContextManager 将不能检索上下文,因为每次调用 GetProperty 以对通道强制执行 NotAllowed 语义时都会创建一个建立会话的新通道。 这意味着即使在上下文已经正确传播回客户端的情况下,也无法使用 IContextManager 进行检索。 但仍可以使用 ContextMessageProperty 进行检索,如下面的代码所示。
using (new OperationContextScope((IContextChannel)channel))
{
    channel.MyChannel("Test");
    ContextMessageProperty context;
    if (ContextMessageProperty.TryGet(OperationContext.Current.IncomingMessageProperties, out context))
    {
        Console.WriteLine(context.Count);
    }
}
属性
| Enabled | 
		 获取或设置一个指示是否已启用上下文管理的值。  | 
        	
方法
| GetContext() | 
		 获取上下文。  | 
        	
| SetContext(IDictionary<String,String>) | 
		 设置上下文。  |