500 Internal Server Error in ASP.NET MVC

后端 未结 4 750
醉梦人生
醉梦人生 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:17

    I got more details of the error from windows event viewer(Run>eventvwr.msc>Windows Logs>Application). Check the warnings/errors recorded from w3wp.exe

    In my case the reason was missing dlls. Hope this helps

    0 讨论(0)
  • 2020-11-30 06:24

    500 Server error means that a script has thrown an error, this is not a broken link (aka a 404 error).

    If you are using Internet Explorer, go to tools > options > advanced and unselect friendly http errors, this will give you a more comprehensive description of the error so you can debug the script, or contact the relevant people to debug it.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-11-30 06:33

    Though a little late, the Anti-Forgery token blocks the request as a security measure.

    Removing all those anti-forgery tags in .cshtml and controller, removed the error for me.

    Though if you want to keep those tokens successfully use this link:- http://iamdotnetcrazy.blogspot.com/2013/08/how-to-solve-anti-forgery-token-could.html

    0 讨论(0)
提交回复
热议问题