ASP.NET MVC中的500内部服务器错误

Ren*_*123 24 asp.net-mvc

我在ASP.NET MVC工作.我正在使用部分视图,但当我点击特定链接时,我收到以下错误.

500内部服务器错误

如何解决这个错误?

Bro*_*nek 52

要检查导致ASP MVC下的内部服务器500错误的原因,您还可以在调试模式下运行应用程序并检查属性AllErrors.
该属性是Exception类型元素的数组.

要做到这一点,打开Global.asax.cs(C#)并在类的MvcApplicationput方法体中Application_EndRequest:

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

然后设置断点并检查数组的内容: this.Context.AllErrors

它帮助我解决了抛出的异常,并可选择查看堆栈跟踪.


Tom*_*len 6

500服务器错误表示脚本已引发错误,这不是链接断开(也称为404错误)。

如果您使用的是Internet Explorer,请转到tools > options > advanced并取消选择friendly http errors,这将为您提供对该错误的更全面的描述,以便您可以调试脚本或联系相关人员进行调试。


sre*_*ree 5

我从 Windows 事件查看器(运行>eventvwr.msc>Windows 日志>应用程序)获得了有关错误的更多详细信息。检查 w3wp.exe 记录的警告/错误

就我而言,原因是缺少 dll。希望这可以帮助