As you are finding, debugging a windows service can be very difficult. In initial development you usually launch the executable from within Visual Studio where you can easily activate breakpoints and debug it. Once it's set up as a service it gets a little trickier.
One option: If you are setting up the service on your development machine, or any machine with Visual Studio for that matter, you can manually attach to the running process from VS. Under Debug->Attach to processes... you can find the process and attach the debugger. This will require the PDB files to be present along side the program's assemblies. Once attached, you can set breakpoints in the code.
Another option: Use a logging library such as log4net. By putting trace statements in your program you can generate very detailed output of the process. The output level can be set to one of I think 5 level within the log4net configuration which is all done in an XML file. lg4net has many output options, one of which is remoting. There is a client app that you can start up to "listen" for your application's tracing messages so you can see in real time what's going on. I haven't used this myself but it sounds very cool.
-Peter
|