WCF端点路由
伙计们,如何在不同端点之间路由入站消息。
我需要公开可以接受不同凭据的单个端点。我想,通过拦截传入消息并基于消息头然后将消息转发到适当的端点来解决此问题。
谢谢。
Guys, how to route inbound message between different endpoints.
I need to expose the single endpoint that could accept different credentials. I guess, solve this by intercept the incoming message and based on message header then do forward message to appropriate endpoint.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
基本上,您需要为拦截器创建自定义行为。这个过程相当深入,所以这里有一个链接,而不是我把所有这些都写出来。
http://msdn.microsoft.com/en-us/magazine/cc163302。 aspx
主要步骤是:
创建自定义行为
创建BehaviorExtension:
然后创建拦截器并将所有代码放入 AfterReceivedRequest 方法中:
然后只需将拦截器添加到配置文件中:
如果您需要更多帮助或指导、评论,我会回复您并提供更多详细信息。最困难的部分是处理传入的请求,因为此时它尚未反序列化,因此您必须将其作为 POX(Plain Ol' Xml)进行处理。
Basically you need to create a custom behavior for your interceptor. The process is rather indepth so here's a link, instead of me typing all of this out.
http://msdn.microsoft.com/en-us/magazine/cc163302.aspx
The main steps are:
Create a custom behavior
Create the BehaviorExtension:
Then create your interceptor and put all of your code in the AfterReceivedRequest method:
Then you just add your interceptor to your config file:
If you need more help or guidance, comment and I'll get back to you with more details. The hardest part is working with the incoming request, as it is not deserialized at this point so you have to work with it as POX (Plain Ol' Xml).
您可以使用的另一种方法是创建自定义授权策略和管理器
http://msdn.microsoft.com/en-us/library/ms729794.aspx" rel="nofollow noreferrer">http:// /msdn.microsoft.com/en-us/library/ms729794.aspx
http://msdn.microsoft.com/en-us/library/ms731774.aspx
Another approach you could use could be to create a custome Authorization Policy and Manager
http://msdn.microsoft.com/en-us/library/ms729794.aspx
http://msdn.microsoft.com/en-us/library/ms731774.aspx