C# Ajax responseText和statusText在不同的服务器上不同

C# Ajax responseText和statusText在不同的服务器上不同,c#,jquery,ajax,asp.net-mvc,http,C#,Jquery,Ajax,Asp.net Mvc,Http,我在ASP.NET MVC中有一个项目,在其中的一个操作中,我返回以下内容: public ActionResult MyAction() { return new HttpStatusCodeResult(HttpStatusCode.NotFound, "custom err msg"); } 此响应被发送到ajax函数并由fail()函数捕获: $.ajax({ url: "url to MyAction", type: 'POST', conte

我在ASP.NET MVC中有一个项目,在其中的一个操作中,我返回以下内容:

public ActionResult MyAction()
{
       return new HttpStatusCodeResult(HttpStatusCode.NotFound, "custom err msg");
} 
此响应被发送到ajax函数并由fail()函数捕获:

$.ajax({
    url: "url to MyAction",
    type: 'POST',
    contentType: "application/json; charset=utf-8",
    dataType: "json"
  })
  .fail(function (data) {
    console.log(data); 
   });
});
当我在本地IIS Express上通过visual studio运行此命令时,console.log(数据)返回:

但是,在我的开发服务器Azure上:it控制台。日志(数据)返回:

responseText
:
"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
status
:
404
statusText
:
"custom err msg"

为什么会这样不一致?在这两台服务器中,我的错误消息在responseText或statusText中都可以这样做。HTTP/2中不再存在状态行。可能服务器正在运行不同版本的HTTP


(另外,fwiw,application/json上没有charset参数)

您是否检查了customErrors模式的web.config设置?一台服务器可能打开,而另一台服务器可能关闭。否,这对“状态行”没有帮助您是指statusText?是的,“状态行”指http消息中的内容,请参阅
responseText
:
"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
status
:
404
statusText
:
"custom err msg"