idispatchmessageinspector

How to use IDispatchMessageInspector in a WCF Service?

一笑奈何 提交于 2019-11-28 11:02:00
I am trying to use IDispatchMessageInspector in a WCF service implementation to access custom header values. Something like: public class MyService : IMyService { public List<string> GetNames() { var headerInspector = new CustomHeaderInspector(); // Where do request & client channel come from? var values = headerInspector.AfterReceiveRequest(ref request, clientChannel, OperationContext.Current.InstanceContext); } } I've implemented my own IDispatchMessageInspector class. public class CustomHeaderInspector : IDispatchMessageInspector { public object AfterReceiveRequest(ref Message request,

How do i get the invoked operation name within a WCF Message Inspector

筅森魡賤 提交于 2019-11-27 14:22:06
I'm doing a message inspector in WCF: public class LogMessageInspector : IDispatchMessageInspector, IClientMessageInspector which implements the method: public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext) I can get the name of the invoked service with: instanceContext.GetServiceInstance().GetType().Name But how do I get the name of the invoked operation? Kent Boogaart It's not pretty, but this is what I did to get the operation name: var action = OperationContext.Current.IncomingMessageHeaders.Action; var operationName = action

How to use IDispatchMessageInspector in a WCF Service?

a 夏天 提交于 2019-11-27 03:55:59
问题 I am trying to use IDispatchMessageInspector in a WCF service implementation to access custom header values. Something like: public class MyService : IMyService { public List<string> GetNames() { var headerInspector = new CustomHeaderInspector(); // Where do request & client channel come from? var values = headerInspector.AfterReceiveRequest(ref request, clientChannel, OperationContext.Current.InstanceContext); } } I've implemented my own IDispatchMessageInspector class. public class

How do i get the invoked operation name within a WCF Message Inspector

蹲街弑〆低调 提交于 2019-11-26 16:43:23
问题 I'm doing a message inspector in WCF: public class LogMessageInspector : IDispatchMessageInspector, IClientMessageInspector which implements the method: public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext) I can get the name of the invoked service with: instanceContext.GetServiceInstance().GetType().Name But how do I get the name of the invoked operation? 回答1: It's not pretty, but this is what I did to get the operation name: var