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
WCF服务中的IncomingWebRequestContext.UriTemplateMatch null_Wcf_Oauth_.net 4.5 - Fatal编程技术网

WCF服务中的IncomingWebRequestContext.UriTemplateMatch null

WCF服务中的IncomingWebRequestContext.UriTemplateMatch null,wcf,oauth,.net-4.5,Wcf,Oauth,.net 4.5,我正在尝试在web服务中实现OAuth,例如: 每次,当Authenticate方法为fire时,WebOperationContext.Current.IncomingRequest存在,但UriTemplateMatch为空。甚至在使用WCF测试客户端时也是如此,所以我的客户端应用程序不是问题所在。最后,我需要访问UriTemplateMatch下的QueryParameters 在Authenticate方法中,这是代码中断的地方: NameValueCollection pa=cont

我正在尝试在web服务中实现OAuth,例如:

每次,当Authenticate方法为fire时,
WebOperationContext.Current.IncomingRequest
存在,但
UriTemplateMatch
为空。甚至在使用WCF测试客户端时也是如此,所以我的客户端应用程序不是问题所在。最后,我需要访问
UriTemplateMatch
下的
QueryParameters

Authenticate
方法中,这是代码中断的地方:

NameValueCollection pa=context.UriTemplateMatch.QueryParameters

正在寻找与此不同的解决方案,以便在一个请求中处理所有内容:


另外,作为一个解决方案,我正在寻找UriTemplateMatch仅在WCF服务中为null的原因。关于这个问题的存在有数百篇文章,但我还没有找到一个好的解决方案和/或解释。我想我的
web.config

中可能遗漏了一些内容。此解决方案似乎需要以下传入呼叫:

http://localhost:49262/TestProject/Service.svc/user/123?oauth_consumer_key=key&oauth_nonce=10a33ed37b549301644b23b93fc1f1c5&oauth_signature=cUobFDxVB5wjPe9X2XICJ6awmnE%3D&oauth_signature_method=HMAC-SHA1&oauth_时间戳=1289976718&oauth_版本=1.0

有两种方法可以附加oauth参数,一种是通过头,另一种是通过查询字符串,两者都是有效的,所以我选择在查询字符串中附加oauth参数。如果这些oauth参数位于标头中,则从IncomingWebRequestContext.Headers检索它们不会有任何问题


这个解决方案不是我的。检查这个。

我也有同样的问题。帮忙?