I know this is a issue discussed in many other threads, but I cannot understand what is not working in my case. I'm working on this asp.net application and I need to get some data via ajax call: everything works fine on my localhost, but I get an error 500 on production server, when ajax call is executed. The server is actually located on LAN, because this is an Intranet application.
These are the headers of the request:
Remote Address:192.168.2.152:80
Request URL:http://www.domain.tld/Ordini.aspx/Orders
Request Method:POST
Status Code:500 Internal Server Error
Request Headersview source
Accept:application/json, text/javascript, */*; q=0.01
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,it;q=0.6,fr;q=0.4,es;q=0.2
Connection:keep-alive
Content-Length:18
Content-Type:application/json; charset=UTF-8
Host:www.domain.tld
Origin:http://www.domain.tld
Referer:http://www.domain.tld/Ordini
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36
X-Requested-With:XMLHttpRequest
Request Payload
{'ordine': '3585'}
Response Headersview source
Content-Length:100
Content-Type:application/json; charset=utf-8
Date:Mon, 09 Jun 2014 10:59:43 GMT
jsonerror:true
Server:Microsoft-IIS/8.0
X-Powered-By:ASP.NET
In the preview tab (Chrome developer tools), I see nothing but a generic Error message and no stack track, or exception type.
I declared the method who has to process the request as a [WebService].
Since everything is working on my localhost, I guess my problem could be related only to IIS, but I don't know which settings may affect the actual behaviour.
*EDIT This is the ajax call:
var ord = $("#ordine").val();
$.ajax({
type: "POST",
url: "Ordini.aspx/Orders",
data: "{'ordine': '" + ord + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
}
});
And this is the method called:
[WebMethod]
public static string Orders(string ordine)
{
string res = Ordine.GetOrderData(ordine);
return res;
}