How do i get the invoked operation name within a WCF Message Inspector
c#-3.0, idispatchmessageinspector, operation, wcf
Solution
It's not pretty, but this is what I did to get the operation name:
var action = OperationContext.Current.IncomingMessageHeaders.Action;
var operationName = action.Substring(action.LastIndexOf("/", StringComparison.OrdinalIgnoreCase) + 1);
Problem
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?