Starting a Service for Debugging

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a windows service project as part of a multi-project solution. To
step through some of the code, I need to debug the service.

1) How do I start the service for debuging. A production version of the
service exists on the machine.
2) Can I then add breakpoints in the service code and step into the other
classes?
 
Hi Tom,

You can set breakpoints and then attach to the running process by selecting
the Debug, Processes menu.

Since the process isn't available until after the Start method executes
you'll have to pull a trick (only if you want to hit a break point in the
Start method, otherwise ignore the rest of this). Add a dummy service to
your code that is installed for the same service process. When you start
the dummy service, it will load the process. After that, you can attach to
the process and will be able to hit a break point in the Start method of the
service you want to debug.

Joe
 
Back
Top