In my WCF client code I add a message inspector (using an IEndpointBehavior).
class MyBehavior : IEndpointBehavior
{
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
clientRuntime.ClientMessageInspectors.Add(new MyMessageInspector());
}
}
public class MyMessageInspector : IClientMessageInspector
{
public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
Console.WriteLine(request.Properties.ContainsKey(HttpRequestMessageProperty.Name));
}
}
Now here comes the part I do not understand:
When I make a WCF call using a proxy configured to use this behavior, the following happens:
- If the call is made from a process running inside the VS2015 debugger,
True
is printed to the console, meaningrequest.Properties["httpRequest"]
is present. - If the call is made from a process running normally (not in the debugger),
False
is printed to the console.
- If the call is made from a process running inside the VS2015 debugger,
Why is WCF configured differently when running inside/outside the VS2015 debugger? How does this happen? Is it documented anywhere?