I'm trying to implement a simple message inspector that writes the message to the debug window from an example on MSDN:
public class MyMessageInspector : IDispatchMessageInspector
{
public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
{
System.Diagnostics.Debug.WriteLine(request.ToString());
return null;
}
public void BeforeSendReply(ref Message reply, object correlationState)
{
System.Diagnostics.Debug.WriteLine(reply.ToString());
}
}
The reply is writing as expected. However the request seems to be null. Any ideas on what could be going wrong? I'm using a Service Reference proxy with a console app as the client.
I'm using basicHttpbinding and hosting with IIS with svc file. The parameter for my web method is a complex type. I'm not sure if that makes a difference.