How to debug Windows Service after Installation of Service


Ahamed Fazil Buhari
SharePoint Developer
Published On :   05 Aug 2017
Visit Count
Today :  7    Total :   131
Plan, Migrate, Secure, Report
SharePoint & Office 365 Tool. Simple & Easy to Use. 15-Day Trial!

SharePoint Office 365 Tool
Simple & Powerful Tool for Migration, Security & Reporting. Free Trial


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

SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Categories

Protect Your SharePoint