title: jqXHR object's responseText being returned as html rather than json
body: <p>On staging, in the error callback, the jqXHR.responseText is being returned as a html string but locally it works perfectly &amp; a json object gets returned in the very same error callback, I'm making a typical asynchronous HTTP (Ajax) request using JQuery. </p>
  
  <p>Snippet of the error callback is shown below</p>
  
  <pre><code>    error: function (jqXHR, textStatus, errorThrown) {
                      l.stop();
                      l.setProgress(0);
                      $("#error").show();
                      try {
                          var data = $.parseJSON(jqXHR.responseText);
                          if (data &amp;&amp; data.Message &amp;&amp; data.Message.length &gt; 0) {
                              $("#error .message").html(data.Message);
                          } else {
                              $("#error .message").html("An unexpected error has occurred.  Please contact support for assistance.");
                          }
                      } catch (ex) {
                          $("#error .message").html("An unexpected error has occurred.  Please contact  support for assistance.");
                      }
  
                  }
  </code></pre>
  
  <p>The jqXHR.responseText that gets returned on staging is shown below</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
     &lt;head&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/&gt;
        &lt;title&gt;500 - Internal server error.&lt;/title&gt;
        &lt;style type="text/css"&gt;
           &lt;!--
              body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
              fieldset{padding:0 15px 10px 15px;} 
              h1{font-size:2.4em;margin:0;color:#FFF;}
              h2{font-size:1.7em;margin:0;color:#CC0000;} 
              h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} 
              #header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
              background-color:#555555;}
              #content{margin:0 0 0 2%;position:relative;}
              .content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
              --&gt;
        &lt;/style&gt;
     &lt;/head&gt;
     &lt;body&gt;
        &lt;div id="header"&gt;
           &lt;h1&gt;Server Error&lt;/h1&gt;
        &lt;/div&gt;
        &lt;div id="content"&gt;
           &lt;div class="content-container"&gt;
              &lt;fieldset&gt;
                 &lt;h2&gt;500 - Internal server error.&lt;/h2&gt;
                 &lt;h3&gt;There is a problem with the resource you are looking for, and it cannot be displayed.&lt;/h3&gt;
              &lt;/fieldset&gt;
           &lt;/div&gt;
        &lt;/div&gt;
     &lt;/body&gt;
  &lt;/html&gt;  
  </code></pre>
  
  <p>Given below is the image when i run this locally, and as you can see the json object gets returned</p>
  
  <p><a href="https://i.stack.imgur.com/Qswyu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qswyu.png" alt="enter image description here"></a></p>
  
  <p>And, here's what happens on staging</p>
  
  <p><a href="https://i.stack.imgur.com/WCjLW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WCjLW.png" alt="enter image description here"></a></p>
  
  <p>The version of IIS on staging is 7.5.7600.16385, and the JQuery version is 2.1.4</p>
  
  <p>Could someone let me know what might be wrong or where I should start looking to fix this issue. </p>
  
  <p>Here' the full code of the ajax call</p>
  
  <pre><code>  $.ajax({
                  type: 'POST',
                  url: '@Url.Action("UpdateAdjustment", "AccredScoring")',
                  dataType : "json",
                  data: $(this).serialize(),
                  success: function (data, textStatus, request) {
                      l.stop();
                      var oTT = TableTools.fnGetInstance('adjustments');
  
                      var row = oTT.fnGetSelected()[0];
                      var headRow = $('#adjustments').children('thead');
  
                      if (currentId == data["Id"]) {
                          $('#adjustments').dataTable().fnUpdate(data, row);
  
                          $(headRow).notify('Adjustment Successfully Updated', 'success', 'top');
                      } else {
                          $('#adjustments').dataTable().fnAddData(data);
  
                          $(headRow).notify('New Adjustment Created', 'success', 'top');
                      }
  
                      $('#EditModal').modal('hide');
  
                  },
                  error: function (jqXHR, textStatus, errorThrown) {
                      l.stop();
                      l.setProgress(0);
                      $("#error").show();
                      try {
                          var data = $.parseJSON(jqXHR.responseText);
                          if (data &amp;&amp; data.Message &amp;&amp; data.Message.length &gt; 0) {
                              $("#error .message").html(data.Message);
                          } else {
                              $("#error .message").html("An unexpected error has occurred.  Please contact NCQA technical support for assistance.");
                          }
                      } catch (ex) {
                          $("#error .message").html("An unexpected error has occurred.  Please contact NCQA technical support for assistance.");
                      }
  
                  },
                  xhr: function () {
                      myXhr = $.ajaxSettings.xhr();
                      if (myXhr.upload) {
                          myXhr.upload.addEventListener('progress',
                              function (evt) {
                                  if (evt.lengthComputable) {
                                      var percentComplete = (evt.loaded / evt.total);
                                      l.setProgress(percentComplete);
                                  }
                              },
                              false);
                      }
                      return myXhr;
                  },
              });
  </code></pre>
  
  <p>If I remote desktop into the staging environment then on accessing the staging url all works well</p>