在WCF运行参数记录通用 [英] Generic logging of operation parameters in WCF

查看:209
本文介绍了在WCF运行参数记录通用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WCF服务(幸福快乐)我所有的消息从抽象类MessageBase继承并实现以下接口。

I have a WCF service (happy joy) all my messages inherit from the abstract class MessageBase and implements the below interface.

public interface IMessageBase<T> where T : class
{
    String Serialize(T data);
    T Deserialize(string text);
}



每一次我的业务合同中的一个被击中这样我要留言记录此消息。当被请求的方法和入站的参数之一是分配给IMessageBase那么我想不实际的方法捏造执行日志记录。我将如何实现这一目标?我想我需要做这在我IDispatchMessageInspector但如何

Each time one of my operation contracts is hit with a message like this I want to log this message. As soon as a method is requested and one of the inbound parameters is assignable to IMessageBase then I want to execute logging without fudging with the actual method. How would I achieve this? I suppose I would need to do this in my IDispatchMessageInspector but how?

推荐答案

检查出一些好的资源:

  • Writing a WCF Message Inspector
  • Creating a WCF Dispatch message inspector
  • MSDN docs on IDispatchMessageInspector

这篇关于在WCF运行参数记录通用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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