I am New in C# I want to capture unhanded exception in Windows services. whey i try this window services crash i don't what's problem... any help will be appreciated.
- 2How about showing us some code providing us with at least the most tiny bit of information about what you're doing?Thorsten Dittmar– Thorsten Dittmar2012-06-01 11:32:38 +00:00Commented Jun 1, 2012 at 11:32
- check in eventviewere of windows this could help you why window service is crashed. and also pass some code snippts here this would help you to get answer quikerJSJ– JSJ2012-06-01 11:39:37 +00:00Commented Jun 1, 2012 at 11:39
- if i never got any answer how can i approve answer..CSS Guy– CSS Guy2012-06-01 11:48:02 +00:00Commented Jun 1, 2012 at 11:48
Add a comment |
1 Answer
Try this
add this in Constructor
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); after Constructor
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { Exception ex =(Exception)e.ExceptionObject; .... }