C# 如何从WCF中的System.ServiceModel.Channels.RequestContext获取HttpMethod
如何从System.ServiceModel.Channels.RequestContext获取HttpMethod? HostedHttpContext的HttpMethod属性C# 如何从WCF中的System.ServiceModel.Channels.RequestContext获取HttpMethod,c#,wcf,rest,C#,Wcf,Rest,如何从System.ServiceModel.Channels.RequestContext获取HttpMethod? HostedHttpContext的HttpMethod属性 (System.ServiceModel.Activation.HostedHttpContext)是内部的 更新-说明: 我已经创建了一个基本身份验证interceptor(继承RequestInterceptor),用于REST WCF服务中的基本HTTP身份验证。 在void ProcessRequest(re
(System.ServiceModel.Activation.HostedHttpContext)
是内部的
更新-说明:
我已经创建了一个基本身份验证interceptor
(继承RequestInterceptor),用于REST WCF服务中的基本HTTP身份验证。
在
void ProcessRequest(ref RequestContext RequestContext)
方法中,我需要检查HTTP方法(例如,如果它是POST)消息应该具有HttpRequestMessageProperty
(其密钥为HttpRequestMessageProperty.Name
。请尝试从上下文中查询请求消息,然后从消息中获取该属性。该属性在请求中使用了HTTP谓词。为什么需要它?这可能有助于解释您尝试执行的更多操作。已使用:(HttpRequestMessageProperty)message.Properties[HttpRequestMessageProperty.Name]