How to Debug a Microsoft Service

Here is a cool trick for debugging a running Microsoft Service.

Create a debug version of the service and where you want to start debugging (usually the first line of the Main method) add the line:


When the line is executed it will display a message to attach a debugger such as this one:

Select, “Yes debug the <ServiceName>”.  This will display a form to select the debugger you want to use.

And you will be stopped at the System.Diagnostics.Debugger.Launch() method in the debugger.


Leave a Reply

Your email address will not be published. Required fields are marked *