I have written a Windows Service in C#/.NET but so far it does not start yet. An excpetion is thrown in its OnStart
method.
As I haven't found any information about the unhandled exception the Windows Event log (except a not very helpful P4: System.Data
), I'm looking for another simple way of getting hold of the stack trace and exception message.
I know, I can try and debug the Windows Service but since it fails in the OnStart
method which runs under a timeout, debugging is not fun. Also, it requires starting VS as admin.
Or should I wrap everything in a try-catch and log the exception somewhere? And if so, where to? What would be best practice?