WCF服务调用包装WCF

2023-09-06 09:44:34 作者:?僵尸是吃了跳跳糖i

什么是用于创建包装WCF服务电话的最佳实践?我觉得还是有必要  监测在同一个地方所有的呼叫,我想用这种code,这是正确的想法?

What is best practice for creating wrapper for WCF service call? I think it is necessary to monitor all calls in the same place, I am thinking to use this kind of code, is this right idea?

RetType t = ServiceExecutionContext<IServiceChanel>.Execute(s=>s.GetServiceMethod());

包装什么样的,你在企业应用程序中使用?非常感谢!

What kind of wrapper are you use in your enterprise applications?Thanks a lot!

推荐答案

WCF有一个模型,可以让你在服务调用链。我会用了,而不是试图总结每一次服务电话,如果所有你想要做的是一些日志记录(如果您打开诊断上的配置文件,该文件WCF已经是非常善于做),共同类似的事情在你的服务呼叫。

WCF has a model that allows you to be in the service call chain. I would use that rather than trying to wrap every service call if all that you are trying to do is some logging (which WCF is already very good at doing if you turn diagnostics on in the config file) and common things like that around your service calls.

下面是有关如何为WCF服务创建自定义行为一个很好的MSDN文章。