Hi,
I've used the abyss webserver a bit over the years, but only recently getting into ASP.NET but hopefully this isn't a noob question.
I have a APS.NET 4.5 service returning JSON to a HTML page using jQuery that works using IIS Express (part of visual studio), but on this webserver the jQuery fails.
This is the service
[DataContract]
public class MapTest
{
[DataMember]
string Msg = "TestResult1";
}
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json)]
public MapTest Test2()
{
// Add your operation implementation here
return new MapTest();
}
And the html page has this
$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
url: "Service.svc/Test2",
data: $('#Test').serialize(),
dataType: "json",
success: function (data) {
alert(data.d.Msg);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(thrownError);
}
});
Using fiddler I can see that from IIS Express the page returns a header with Content-Type: application/json; charset=utf-8
and body of
{"d":{"__type":"Service.MapTest:#","Msg":"TestResult1"}}
But using Abyss it is returning header of Content-Type: text/html; charset=UTF-8
And body of
<HTML><HEAD><STYLE type="text/css">#......This is a Windows Communication Foundation service...
Which is what is returned if you call the Service.svc directly in the browser.
Any ideas what I'm doing wrong? Can Abyss handle ASP.NET returning JSON?
It is basically a default install of Abyss (current version) with ASP.NET 4.5 configured and compression turned off (for debugging)
Any help is appreciated