Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何从WCF中的System.ServiceModel.Channels.RequestContext获取HttpMethod_C#_Wcf_Rest - Fatal编程技术网

C# 如何从WCF中的System.ServiceModel.Channels.RequestContext获取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.Channels.RequestContext获取HttpMethod? HostedHttpContext的HttpMethod属性
(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]