c# - Easier way to debug a Windows service -
is there easier way step through code start service through windows service control manager , attaching debugger thread? it's kind of cumbersome , i'm wondering if there more straightforward approach.
if want debug service, drop in debugger.break()
in there. when line reached, drop me vs. don't forget remove line when done.
update: alternative #if debug pragmas, can use conditional("debug_service")
attribute.
[conditional("debug_service")] private static void debugmode() { debugger.break(); }
on onstart, call method:
public override void onstart() { debugmode(); /* ... rest */ }
there, code enabled during debug builds. while @ it, might useful create separate build configuration service debugging.
Comments
Post a Comment