500 Internal Server Error in ASP.NET MVC

后端 未结 4 777
醉梦人生
醉梦人生 2020-11-30 06:13

I am working in ASP.NET MVC. I am using partial views, but when I clicked on particular link I got the following error.

500 Internal Server Error

4条回答
  •  南笙
    南笙 (楼主)
    2020-11-30 06:33

    To check what causes Internal Server 500 Error under ASP MVC you can also run your app in debug mode and check property AllErrors.
    The property is an array of Exception type elements.

    To do this open Global.asax.cs (C#) and in the body of class MvcApplication put method Application_EndRequest:

    protected void Application_EndRequest()
    {   //here breakpoint
        // under debug mode you can find the exceptions at code: this.Context.AllErrors
    }
    

    Then set breakpoint and check contents of the array: this.Context.AllErrors

    It helped me to resolve what exception was thrown and optionally to see the stacktrace.

提交回复
热议问题