How to debug Windows Service after Installation of Service

Ahamed Fazil Buhari
 
Senior Developer
August 5, 2017
 
Rate this article
 
Views
9381

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”

clip_image002

· Once the installation is successful you can find your service in ‘Service Control Manager’ and start your service.

clip_image004

· 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).

clip_image006

· 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

clip_image008

· Now you are in debug mode. You can debug just like other common visual studio project

clip_image010

Happy Coding

Ahamed

Category : Windows

Author Info

Ahamed Fazil Buhari
 
Senior Developer
 
Rate this article
 
Ahamed is a Senior Developer and he has very good experience in the field of Microsoft Technologies, especially SharePoint, Azure, M365, SPFx, .NET and client side scripting - JavaScript, TypeScript, ...read more
 

Leave a comment