Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

500 Internal Server Error in ASP.NET MVC

Tags:

asp.net-mvc

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

How can this error be fixed?

like image 592
Renu123 Avatar asked Jun 08 '10 09:06

Renu123


People also ask

How do I fix a 500 Internal server error?

Clear your browser cache and cookies Check these articles on deleting the cache on an Android phone or iPhone, if you use a mobile device. Alternatively, you can test opening the page from another browser. For instance, if you use Chrome, try Firefox or vice versa.

How do you solve 500 Internal server error There is a problem with the resource you are looking for and it Cannot be displayed?

500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed. To resolve this issue, set the Enable 32-bit Applications to "False": Open the Internet Information Services (IIS) Manager.

What is an error 500 internal server error?

The HTTP status code 500 is a generic error response. It means that the server encountered an unexpected condition that prevented it from fulfilling the request. This error is usually returned by the server when no other error code is suitable.


2 Answers

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.

like image 108
Bronek Avatar answered Sep 23 '22 06:09

Bronek


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.

like image 38
Tom Gullen Avatar answered Sep 22 '22 06:09

Tom Gullen