简体   繁体   English

WCF期望每个请求上的标头

[英]WCF expect header on every request

I'm not sure how simple this is but I am trying to achieve a WCF Restful Service but whenever a method is hit I want it "intercepted" , This interception will check if header information exists identifying the user. 我不确定这有多简单,但是我正在尝试实现WCF Restful Service,但是每当一个方法被点击时,我都希望它被“拦截” ,这种拦截将检查是否存在标识用户的标头信息。

At the moment I am researching the best way to do this and have come across numerous mechanisms. 目前,我正在研究实现此目的的最佳方法,并且遇到了许多机制。

Search results before posting this comes up with "WCF REST Starter Kit" but my searching indicates this is abandoned! 发布此内容之前的搜索结果附带“ WCF REST Starter Kit”,但我的搜索表明这被放弃了!

Additionally, there is apparently something called a "RequestInterceptor" but not found a great deal on this either. 另外,显然有一个叫做“ RequestInterceptor”的东西,但是在这方面也没有发现很多东西。 I have come across the "ServiceAuthorizationManager" which I have had trouble with for a few days now (in the sense that it never gets called even though I set it the config) 我遇到了几天以来遇到麻烦的“ ServiceAuthorizationManager” (就算我将其设置为配置也从未调用过)

<serviceAuthorization serviceAuthorizationManagerType="SomeNamespace.MyAuthorizationManager,SomeNamespace" />

I have my service operational and one way I have this validation working is via inheritance. 我可以运行服务,并且可以通过继承来进行此验证。 Not a great approach but hoping for someone to suggest a better way. 这不是一个很好的方法,但是希望有人提出更好的方法。

No restriction on version of .NET as this is a personal exercise I am working on :) .NET版本没有限制,因为这是我正在从事的个人练习:)

如果要检查传入的请求消息,请检查消息检查器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM