WebOperationContext 类  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
一个使您可以轻松访问 Web 请求和响应上下文属性的帮助器类。
public ref class WebOperationContext : System::ServiceModel::IExtension<System::ServiceModel::OperationContext ^>
	public class WebOperationContext : System.ServiceModel.IExtension<System.ServiceModel.OperationContext>
	type WebOperationContext = class
    interface IExtension<OperationContext>
	Public Class WebOperationContext
Implements IExtension(Of OperationContext)
		- 继承
 - 
				WebOperationContext
 
- 实现
 
示例
下面的代码演示如何检索与当前调用的 Web 操作上下文关联的 UriTemplateMatch 实例。 此代码还演示如何设置传出响应的 HTTP 状态。
counter++;
UriTemplateMatch match = WebOperationContext.Current.IncomingRequest.UriTemplateMatch;
UriTemplate template = new UriTemplate("{id}");
customer.Uri = template.BindByPosition(match.BaseUri, counter.ToString());
customers[counter.ToString()] = customer;
WebOperationContext.Current.OutgoingResponse.SetStatusAsCreated(customer.Uri);
counter = counter + 1
Dim match As UriTemplateMatch = WebOperationContext.Current.IncomingRequest.UriTemplateMatch
Dim template As New UriTemplate("{id}")
customer.Uri = template.BindByPosition(match.BaseUri, counter.ToString())
customers(counter.ToString()) = customer
WebOperationContext.Current.OutgoingResponse.SetStatusAsCreated(customer.Uri)
	构造函数
| WebOperationContext(OperationContext) | 
		 使用指定的 WebOperationContext 实例初始化 OperationContext 类的新实例。  | 
        	
属性
| Current | 
		 获取当前 Web 操作的上下文。  | 
        	
| IncomingRequest | 
		 获取正在接收的请求的 Web 请求上下文。  | 
        	
| IncomingResponse | 
		 获取正在接收的响应的 Web 响应上下文。  | 
        	
| OutgoingRequest | 
		 获取正在发送的请求的 Web 请求上下文。  | 
        	
| OutgoingResponse | 
		 获取正在发送的响应的 Web 响应上下文。  |