Original: C # Development Artifice: Debugging Windows System Services
Windows system services cannot be run directly and can only be started, paused, resumed, and stopped after the service has been installed, causing debugging of the service not to use normal breakpoint debugging.
To debug a system service, you can attach to a process by finding the "debug" option in the VS toolbar and choosing "Attach to Process"
Then select the appropriate service attach, and then start the service to debug (provided that you have broken down in the code of the service).
However, the above method can not debug the OnStart method, that is, the start of the service can not be debugged to, this time, you need to add debugger.launch () in the OnStart method. Here is an introduction: http://www.cnblogs.com/xzwplus/ Archive/2009/07/06/1129452.html
C # Development Artifice: Debugging Windows System Services