public class MessageInspector : IDispatchMessageInspector
{
public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
{
return DateTime.Now;
}
public void BeforeSendReply(ref Message reply, object correlationState)
{
var msg=reply.CreateBufferedCopy(int.MaxValue);
}
}
我想要达到的效果是,在BeforeSendReply 方法里面获取正常的结果,然后对结果进行处理。比如,把所有中文简体转成繁体,然后再返回。
我查阅了许多帖子,他们是通过 reply.toString()获取值,但是亲测似乎是不行,可以是比较老的帖子,随着版本更新,摒弃了这种方式。