title: jquery Ajax responsetext "There was an error processing the request"
body: <p>I am getting this error <strong><em>"There was an error processing the request"</em></strong> in the UAT environment. In my local, the code seems to be working fine. </p>
  
  <p>This line <strong>Utility.WriteLogEvent("TestService", strMessage);</strong> is writing directly to db. Either way if this line fails or not, I should still be able to recieve a message coming from the server since it is properly handled.</p>
  
  <p>But since I don't receive any response from the server, that means my webmethod is not reachable.</p>
  
  <p>Given that the code below works, is there anything that I need to set in the web.config to make this work? Or anywhere I can start inspecting on the IIS that could give me some clues?</p>
  
  <p>Thanks.</p>
  
  <pre><code>$('#lnkTest').click(function () {
      alert('Click event is firing!');
      $.ajax({
          type: "POST",
          url: "/_layouts/ServiceForm.aspx/TestService",
          data: "{}",
          dataType: "json",
          contentType: "application/json; charset=utf-8",
          success: function (response) {
              if (response.d &amp;&amp; response.d.length &gt; 0) {
                  alert(response.d);
              }
          },
          error: function (xhr, err) {
              alert('responseText:' + xhr.responseText);
          }
      });
  });
  </code></pre>
  
  <p>Here is my c# web method</p>
  
  <pre><code>[WebMethod]
  public static string TestService()
  {
      string strMessage = string.Empty;
      try
      {
          strMessage = "The service is running.";
          Utility.WriteLogEvent("TestService", strMessage);
      }
      catch (Exception ex)
      {
          strMessage = "TestService fail.";
  
      }
      return strMessage;
  }
  </code></pre>