View previous topic :: View next topic |
Author |
Message |
ncoda -
Joined: 18 Jan 2014 Posts: 1
|
Posted: Sat Jan 18, 2014 3:39 am Post subject: ASP.NET returning JSON from a service |
|
|
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
Code: |
[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
Code: |
$.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
Quote: | {"d":{"__type":"Service.MapTest:#","Msg":"TestResult1"}}
|
But using Abyss it is returning header of Content-Type: text/html; charset=UTF-8
And body of
Quote: | <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 |
|
Back to top |
|
|
aprelium-support -
Joined: 20 Feb 2009 Posts: 356
|
Posted: Sat Jan 18, 2014 9:22 am Post subject: Re: ASP.NET returning JSON from a service |
|
|
ncoda,
Could you please contact our technical support and send us the project (with the generated files) so that we can give the whole thing a try. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
Gleedaniel13 -
Joined: 25 Jul 2013 Posts: 22
|
Posted: Thu Feb 06, 2014 3:55 pm Post subject: |
|
|
Quote: | 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.
|
That is one of the complicated code I want to learn with.So I think I should have learn the most fundamentals in this programming. _________________ Web Design Integration |
|
Back to top |
|
|
|