Here at work, I keep seeing a couple of my fellow developers struggle to debug their Windows Service apps that they're writing. What they have to do is remove the service, install the new version of the service, start the service, then attach the debugger. If there's an error when the service first starts up, the workaround is to introduce a Thread.Sleep before it actually does anything, giving you enough time to attach the debugger. By default, you can't directly run the service from within Visual Studio. If you try, you get the following message: If you look at the code that actually starts the service, you'll see that it's not that different from a console app. By default, it looks something like this: internal static class Program { /// <summary> /// The main entry point for the application. /// </summary> private static void Main() { ServiceBase [] Ser
Comments
Post a Comment