标识要在其合同是一个WCF服务,称为 [英] Identify on which Contract was a WCF service called

查看:82
本文介绍了标识要在其合同是一个WCF服务,称为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是:有可能知道至极的合同被称为在多合同​​的服务?在这方面,情况下,在构造

My question is: Is possible to know wich contract has been called in a multiple contract service? In this, case, in the constructor.

实现类的服务是这样的:

The implementing class of the service is like this:

public class Service : IContract1, IContract2
{
    public Service()
    {
        //Identify if constructor wass called from IContract1 or IContract2
    }
}

在此先感谢!

推荐答案

我想你想实现什么是的 WCF消息督察。一个MessageInspector是一个消息过滤器,它可以拦截和检查在未来或走出去服务层基础设施的消息。

I think what you want to implement is a WCF Message Inspector. A MessageInspector is a "message filter" that can intercept and inspect the messages coming in or going out of the service layer infrastructure.

在服务器中,你会落实< A HREF =htt​​ps://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.idispatchmessageinspector(v=vs.110).aspx相对=nofollow> IDispatchMessageInspector接口。

On the server, you would implement the IDispatchMessageInspector Interface.

下面是一个很好的例子:

Here is a pretty good example:

http://www.aspnet4you.com/wcf/index的.php / 2013/01/30 /消息拦截的审计和日志记录,在WCF的流水线/

这篇关于标识要在其合同是一个WCF服务,称为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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