ok i have a problem with the production environment and how jquery ajax captures the error.
In my development environment on my local machine when the jquery ajax calls a webservice [webmethod] and the webmethod throws a specific error, the jquery ajax captures that correctly but in production envirnment the jquery ajax captures the error but the message is generic "There was an error processing the request." with "Internal Server Error"
for example
The c# code
[WebMethod]
public String dostuff(String Auth){
// some code here
// if error occurs
throw new Exception("Some specific error message");
return "ok";
}
the jquery ajax call
var data = JSON.stringify({ Auth: "some data here" }, null);
$.ajax({
type: "POST",
url: '/Services/memberService.asmx/dostuff',
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
alert(result.d); // alert ok
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("responseText=" + XMLHttpRequest.responseText + "\n textStatus=" + textStatus + "\n errorThrown=" + errorThrown);
}
});
on my local machine the XMLHttpRequest.responseText is "Some specific error message"
on the production environment the XMLHttpRequest.responseText is "There was an error processing the request."
the local environment is windows 7 home premium with IIS 7.5.7600.16385
the production environment is Windows Server 2008 R2 with IIS 7.5.7600.16385 (same as development environment)
why the difference and how to make the production environment throw the specific error?
********* just a follow up .. tnx Justin *************
i added web.config file inside the services folder (Doh... wonder why i didn't think about this)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<customErrors mode="Off" />
</system.web>
</configuration>