Search code examples
c#jsonrestfiddlerservicestack

ServiceStack JsonServiceClient, force traffic on the wire for localhost?


This ServiceStack client code works:

var client = new JsonServiceClient("http://localhost:32949/test");
var request = new MyRequest { ClassificationId = new ClassificationId (21300) };
var response = client.Post(request);

However, when observing the traffic in Fiddler, I see nothing. I would like to observe the traffic to get a better idea on how to build the required JSON request for other clients I have to write.

To make the above code work, I had to reference the assembly that has the service, and I am suspecting that ServiceStack is making some clever calls to avoid sending a HTTP request. Is this the case ?

Why am I not seeing any traffic in Fiddler, and how do I force it ?

HTTP traffic to localhost endpoints via the browser is shown correctly.


Solution

  • Edit your hosts file, located at

    C:\Windows\System32\drivers\etc\hosts

    and add the following entry

    127.0.0.1 mymachine.com

    then point your client to mymachine.com instead of localhost