I want to debug a service written in C# and the old fashioned way is just too long. I have to stop the service, start my application that uses the service in debug mode (Vis
Here is a blog post about running your windows service as a console app.
You could also just create a new Console Application that references the same logic as your service to test methods, or set up Unit Tests on your services' logic
TopShelf is another project that is perfect for this approach. It allows you to run a process as a service, or as a regular console application with minimal configuration.
I tend to have either a config setting or use a directive for debug builds:
#if DEBUG
Debugger.Break();
#endif
or
if(Settings.DebugBreak)
Debugger.Break();
I put that in the OnStart method of the service component. Then you are prompted automatically and attached to the process.
I have used unit tests to debug difficult setups in the past, just write a unit test that calls whatever service method with whatever parameters and set debug breakpoints in the unit test.
Using testdriven.net or jetbrains testrunner makes it easier.