The browser is requesting html so ServiceStack is returning the html snapshot.
There are a couple of ways to stop the snapshot view:
- First is to use the ServiceClient classes provided by servicestack. These also have the advantage of doing automatic routing and strongly typing the response DTOs.
- Next way would be to set the
Accept
header of the request to something likeapplication/json
orapplication/xml
which would serialize the response into json or xml respectively. This is what the ServiceClients do internally
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Accept = "application/json"; ...
- Another method would be to add a query string parameter called
format
and set it tojson
orxml
string url = "http://localhost:51450/hello/?format=json";