将WCF请求消息映射到基础操作 [英] Mapping a WCF request message to the underlying operation

查看:89
本文介绍了将WCF请求消息映射到基础操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过检查IDispatchMessageInspector中的请求消息对象来知道正在调用什么操作.

I need to know what operation is being invoked by examining a request Message object in an IDispatchMessageInspector.

做到这一点的最佳方法是什么?

What is the best way to do this?

推荐答案

确实没有100%可以肯定的方法,因为IDispatchMessageInspector.AfterReceiveRequest()在调度程序将消息与服务上的实际操作匹配之前运行.也就是说,如果您使用默认的 IDispatchOperationSelector ,则可以在ApplyDispatchBehavior()期间构建一个将SOAP操作名称与操作名称匹配的映射.我有一篇博客文章,稍微介绍了此处.

There's really no 100% sure way of doing this, because IDispatchMessageInspector.AfterReceiveRequest() runs before the dispatcher has matched the message to an actual operation on the service. That said, if you're using the default IDispatchOperationSelector, then it's possible to build a map that matches SOAP Action names with operation names during ApplyDispatchBehavior(). I have a blog post that talks a little bit about this here.

这里有一个示例,说明如何在某些代码上构建此地图

There's a bit of an example of how to build this map on some code here.

这篇关于将WCF请求消息映射到基础操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆