由于stackoverflow导致应用程序崩溃

这个错误让我非常伤心。 我无法在Application_OnError中捕获此错误。 我能得到的唯一消息是事件查看器日志。

Application: w3wp.exe Framework Version: v4.0.30319 Description: The process was terminated due to stack overflow. Faulting application w3wp.exe, version 7.0.6001.18000, time stamp 0x47919413, faulting module nlssorting.dll, version 4.0.30319.235, time stamp 0x4da3fc88, exception code 0xc00000fd, fault offset 0x000020d4, process id 0x%9, application start time 0x%10. 

我有一个非常大的应用程序,并且由于上述错误,我无法判断stackoverflow的确切原因在哪里。 你能帮我解决这个问题吗?

您可以在Application_End中获得更多帮助。 从这里,您可以使用类似的东西捕获关闭堆栈…

 HttpRuntime runtime = (HttpRuntime)typeof(System.Web.HttpRuntime).InvokeMember("_theRuntime", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField, null, null, null); (string)runtime.GetType().InvokeMember("_shutDownStack", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null); (string)runtime.GetType().InvokeMember("_shutDownMessage", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null);