Hello everyone, in this article we will see how to debug Windows Service after installing that Service. Always debugging a Windows Service Project in Visual Studio is challenging task. Usually most people your logger to keep track on what’s going on inside the service. But still it won’t be that much effective as debugging. In my previous article I explained How to debug Windows Service without installing. Here we can see how to debug after installing. Let’s get started.
· Install your Windows Service by using below command and make sure you built this solution in Debug mode (not release mode) and install that service. To know more about Windows Service Installation please refer my other article “How to manually install Uninstall Windows Service”
· Once the installation is successful you can find your service in ‘Service Control Manager’ and start your service.
· Open Visual Studio(run as Administrator), then go to Tools -> Options -> Debugging -> Symbols and check Microsoft Symbol Servers (If we are debugging system process and we want to have symbols for system calls then we must add this Microsoft Symbol Servers).
· Click on Ctrl+Alt+P or go to Tools -> Attach to Process… and attach the process (your service name in VS) that you want to debug. Make sure your service is started in Service Control Manager
· Now you are in debug mode. You can debug just like other common visual studio project