显示500个内部服务器错误的完整详细信息
-
23-10-2019 - |
题
如何在返回500内部错误的页面中看到完整错误?
我所看到的是错误号和描述 - 内部服务器错误 - 没有确切的错误详细信息?
其他提示
检查错误日志。它们所在的位置取决于您的Serer设置。
如果错误在您的ASP.NET应用程序上发生,则可以捕获错误并将其发送给您自己。
您可以在global.asax文件中捕获错误...
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
Dim sb As New StringBuilder
sb.AppendFormat("Page Location: {0}", Context.Request.RawUrl)
With Server.GetLastError.GetBaseException
sb.AppendFormat("Message: {0}", .Message)
sb.AppendFormat("Source: {0}", .Source)
sb.AppendFormat("Method: {0}", .TargetSite)
sb.AppendFormat("Stack Trace: {0}", .StackTrace)
End With
Dim ErrorMsg As String = sb.ToString()
' Post thee error to a logger...
End Sub
G。
不隶属于 StackOverflow