Wednesday, November 10, 2010

How to Debug Windows Service

How to Debug a Windows Service?

If a Windows Service is developed using Visual Studio IDE and if the Windows Service is already installed on your computer. Open the windows Service in Visual Studio.
Go to the Debug menu and choose "Attach to Process." It will show the list of all available processes. We need to find the service process under managed code. Enable the option for "Show processes from all users." Now select the windows service you want to debug.
Click Attach button to attach the debugger for the service and to start the project  debugging. When the breakpoint is hit then you can use F9 or F10 to debug the code line by line.

Screenshot displaying the window to attach the windows service(LoggingService.exe) .