Debugging a Windows Service is a pain, especially when you've got some code running on startup - that doesn't give you enough time to attach to the process unless you intentionally add a Sleep or something similar. Anyway, I found a really good blog post here about debugging Windows Services from right within Visual Studio. Click
here for the details.
I've always used pre-processor directives to get the code to run as a Console Application while debugging... or I would put my code into a class library and temporarily call it from a Console Application instead of a Windows Service.
ReplyDelete