I've been developing and debugging a windows service for my current project. Working with a Windows service is very much like working with a console app, with the startup and shutdown logic separated into the servicebase's start and stop methods.
Debugging a Windows Service
Unlike a console app, however Visual studio can't run a windows service and automatically attach the debugger (no Run-with-Debugger (F5) support). Not to fear, its easily enough to attach the debugger to the windows service. In my case, my service was starting and stopping right away, with no opportunity to attach the visual studio debugger to the running service. Instead I added this handy dandy line of code to the constructor of the service class:
when the service starts, Windows prompts you to attach a debugger.
Select the debugger of choice and step through your windows service.
Removing and Reinstalling a Windows Service
I ran into a problem attempting to uninstall and reinstall my windows service. I was able to delete the service fine, but when I attempted to reinstall the windows service I received a "The Specified Service has been marked for deletion" exception.
Microsoft recommends rebooting to solve this problem; a solution that is not very conducive to a development cycle. Fortunately I stumbled upon a easier solution.
It seems that when the windows service list is visible (Start->Control Panel->Administrative -> Services), the list of windows services is cached and locked resulting in the "The Specified Service has been marked for deletion" exception. The fix, close the services dialog. With the dialog closed, I was able to re-install the windows service without issue.
I've switched my process to starting and stopping the service using Net Start/ Net Stop batch files.