title: c# exception not captured correctly by jquery ajax
body: <p>ok i have a problem with the production environment and how jquery ajax captures the error.</p>
  
  <p>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"</p>
  
  <p>for example</p>
  
  <p>The c# code</p>
  
  <pre><code>[WebMethod]
  public String dostuff(String Auth){
  // some code here
  // if error occurs
  throw new Exception("Some specific error message");
  return "ok";
  }
  </code></pre>
  
  <p>the jquery ajax call</p>
  
  <pre><code>    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);
          }
      });
  </code></pre>
  
  <p>on my local machine the <strong>XMLHttpRequest.responseText</strong> is <strong>"Some specific error message"</strong></p>
  
  <p>on the production environment the <strong>XMLHttpRequest.responseText</strong> is <strong>"There was an error processing the request."</strong></p>
  
  <p>the local environment is windows 7 home premium with IIS 7.5.7600.16385</p>
  
  <p>the production environment is Windows Server 2008 R2 with IIS 7.5.7600.16385 (same as development environment)</p>
  
  <p>why the difference and how to make the production environment throw the specific error?</p>
  
  <p><em><strong></em>**<em>*</em>**<em>*</em>**<em>*</em></strong> just a follow up .. tnx Justin <strong><em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em></strong></p>
  
  <p>i added  web.config file inside the services folder (Doh... wonder why i didn't think about this)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
      &lt;system.web&gt;
        &lt;customErrors mode="Off" /&gt;
      &lt;/system.web&gt;
  &lt;/configuration&gt;
  </code></pre>