应用程序因堆栈溢出而崩溃

4

这个错误让我很困扰。我无法在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_OnError中的错误,但是HttpContext.Current.Server.GetLastError()中没有任何内容。 - Rocky Singh
StackOverflowExceptions在CLR中被特殊处理,所以如果它没有在Application_OnError中被捕获,我不会感到惊讶。然而,如果不了解你的应用程序更多的信息,将无法帮助你确定原因。也许是一个递归方法引起的? - M.Babcock
好的,当我第一次看到这个问题时,我以为你在抱怨这个网站... - Biosci3c
请查看以下网页:https://dev59.com/NnA75IYBdhLWcg3w49cR#3045137 - Aristos
以上链接引导我到这个链接http://blogs.msdn.com/b/tess/archive/2008/02/04/net-debugging-demos-information-and-setup-instructions.aspx。我正在运行IIS7.5和Windows 7。上述链接需要tinyget.exe。你能帮我找到tinyget.exe吗? - Rocky Singh
显示剩余5条评论
1个回答

2
你可以在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);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接