we are getting a stack overflow in production ~ 2-4 times / day
We cannot reproduce this is 开发者_JAVA技巧in dev environment, nad given this is a web app with probably ~100 concurrent users at any one time, I'm struggling to work out how best to track this down.
Is there anyway to get any more info from event viewer - happy to install some form of listener tool - even if i can just get teh thread identity (set to the current user) that'll help - although the dll + class / function woudl be great!
Or is it just a matter of digging, trying to reproduce or adding some tracing in??
There is an IISDiag tool that you can run on production IIS to analyze crashes. Some information here:
http://support.microsoft.com/kb/919790
It's not just for leaks -- it dumps something like a CORE file that you can analyze later.
Slap on Elmah for exception logging. Adding logging of unhandled exceptions using Elmah only require you to drop in the assembly into the application bin folder and to add Elmah section in the web config for a basic logging scenario.
If the logs is not enough to determine the error source you can create memory dumps of the state of the failing application using DebugDiag. There is a guide on how to use it here.
You can put a global exception handler in the global.asax file. Put an exception handler in and then write the stack trace to the event log. This article has a pretty good summary of how to do it though I'm sure there are a lot of others too. Once you know where the error is occurring you can put in some additional logging in the function that the error is occurring in and hopefully narrow it down until you find the specific problem.
精彩评论