I have to say that debugging Windows Services in VS.NET is certainly much easier than it was in VC++, but I still wish it was easier. If you need to do it, here are a few tricks:
- You can’t use F5 to run it. Bummer. Makes debugging the startup code a bitch.
- Make sure the Server Explorer window is available. You will use it a lot when working with services and the event log.
- In Server Explorer, expand the Services Node and right click on your service. Choose Start.
Use Debug Processes to attach to your service. You may have to check the “Show system services” checkbox depending on how your service is installed.
- Any breakpoints you’ve set in your service should work now.
- Remember to Stop your service before building the project or it won’t be able to overwrite the .EXE.
- You can view the event _place_holder;log from the Server Explorer. One thing that is really nice is that the tree automatically has one node per Event Source, so if you used your own (and you should), it makes your messages easy to find. The bad thing is that is doesn’t have a very nice view for seeing the message text. If it is long, you’ll get annoyed and launch Event Viewer.
Playing Now: Chevelle - Point #1