ASP.NET Web API: Non-descriptive 500 Internal Server Error

前端 未结 10 1246
难免孤独
难免孤独 2020-12-07 16:08

As title says, I’ve got 500 Internal Server Error from GET request to an IQueryable action. The body of the error is empty. That error happens after my action returns result

10条回答
  •  不思量自难忘°
    2020-12-07 17:03

    I usually use the Global.asax to catch all error. Here is a code snip you can use

    public void Application_Error(object sender, EventArgs e)
    {
      Exception exc = Server.GetLastError();
      MvcApplication mvcApplication = sender as MvcApplication;
      HttpRequest request = null;
      if (mvcApplication != null) request = mvcApplication.Request;
    }
    

提交回复
热议问题