I am working in ASP.NET MVC. I am using partial views, but when I clicked on particular link I got the following error.
我在ASP.NET MVC工作。我正在使用部分视图,但当我点击特定链接时,我收到以下错误。
500 Internal Server Error
500内部服务器错误
How can this error be fixed?
如何解决这个错误?
4 个解决方案
#1
4
500 Server error means that a script has thrown an error, this is not a broken link (aka a 404 error).
500服务器错误意味着脚本抛出了错误,这不是一个损坏的链接(也就是404错误)。
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.
如果您使用的是Internet Explorer,请转到工具>选项>高级并取消选择友好的http错误,这将为您提供更全面的错误描述,以便您可以调试脚本,或联系相关人员进行调试。
#2
40
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.
要检查导致ASP MVC下的内部服务器500错误的原因,您还可以在调试模式下运行应用程序并检查属性AllErrors。该属性是Exception类型元素的数组。
To do this open Global.asax.cs
(C#) and in the body of class MvcApplication
put method Application_EndRequest
:
要做到这一点,打开Global.asax.cs(C#)并在类MvcApplication中放置方法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
然后设置断点并检查数组的内容:this.Context.AllErrors
It helped me to resolve what exception was thrown and optionally to see the stacktrace.
它帮助我解决了抛出的异常,并可选择查看堆栈跟踪。
#3
1
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
我从Windows事件查看器(运行> eventvwr.msc> Windows日志>应用程序)获得了有关错误的更多详细信息。检查从w3wp.exe记录的警告/错误
In my case the reason was missing dlls. Hope this helps
在我的情况下,原因是缺少dll。希望这可以帮助
#4
0
Though a little late, the Anti-Forgery token blocks the request as a security measure.
虽然有点晚,但Anti-Forgery令牌会阻止请求作为安全措施。
Removing all those anti-forgery tags in .cshtml and controller, removed the error for me.
删除.cshtml和控制器中的所有防伪标签,为我删除了错误。
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
虽然如果你想保留这些令牌成功使用此链接: - http://iamdotnetcrazy.blogspot.com/2013/08/how-to-solve-anti-forgery-token-could.html
#1
4
500 Server error means that a script has thrown an error, this is not a broken link (aka a 404 error).
500服务器错误意味着脚本抛出了错误,这不是一个损坏的链接(也就是404错误)。
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.
如果您使用的是Internet Explorer,请转到工具>选项>高级并取消选择友好的http错误,这将为您提供更全面的错误描述,以便您可以调试脚本,或联系相关人员进行调试。
#2
40
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.
要检查导致ASP MVC下的内部服务器500错误的原因,您还可以在调试模式下运行应用程序并检查属性AllErrors。该属性是Exception类型元素的数组。
To do this open Global.asax.cs
(C#) and in the body of class MvcApplication
put method Application_EndRequest
:
要做到这一点,打开Global.asax.cs(C#)并在类MvcApplication中放置方法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
然后设置断点并检查数组的内容:this.Context.AllErrors
It helped me to resolve what exception was thrown and optionally to see the stacktrace.
它帮助我解决了抛出的异常,并可选择查看堆栈跟踪。
#3
1
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
我从Windows事件查看器(运行> eventvwr.msc> Windows日志>应用程序)获得了有关错误的更多详细信息。检查从w3wp.exe记录的警告/错误
In my case the reason was missing dlls. Hope this helps
在我的情况下,原因是缺少dll。希望这可以帮助
#4
0
Though a little late, the Anti-Forgery token blocks the request as a security measure.
虽然有点晚,但Anti-Forgery令牌会阻止请求作为安全措施。
Removing all those anti-forgery tags in .cshtml and controller, removed the error for me.
删除.cshtml和控制器中的所有防伪标签,为我删除了错误。
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
虽然如果你想保留这些令牌成功使用此链接: - http://iamdotnetcrazy.blogspot.com/2013/08/how-to-solve-anti-forgery-token-could.html