标识要在其合同是一个WCF服务,称为 [英] Identify on which Contract was a WCF service called
问题描述
我的问题是:有可能知道至极的合同被称为在多合同的服务?在这方面,情况下,在构造
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 =https://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屋!