Debugging service by attaching service to viusal studio Attach to Process
To debug the service from visual studio attach to process, follow the below steps.
- Open visual studio as "run as administrator"
- Open solution/project
- Install the service
- Start the service
- From visual studio menu bar select Debug -> Attach to Process
- Select show process from all users & Show process in all sessions check boxes in Attach to Process dialog
- Select the service (Service will be appeared with the name which we have given in installer class. in our example it is WindowsServiceExample) and click on Attach button
- Once the timer ticks is elapsed, debugger will be fired
- Now you can continue debugging to test the functionality