I’m creating a simple windows service using Visual Studio 2010 and .NET 4. I want to be able to easily test it by simply running the resulting exe without the need to install the service. I did some research on this topic and found three helpful articles:
- HybridService: Easily Switch between Console Application and Service (on CodeProject)
- Run Windows Service as a console program
- Creating a windows service in visual studio 2010 (in VB)
I found that the first article was a bit more work than the second. In the end, I pretty much combined the latter two articles’ approaches and created a simple template (in C#) that can be used as a starting point for any long-running windows service. It’s still a work in progress, but I figure this will probably give some folks a head start and also is an opportunity for folks to tell me what I’m doing wrong.
To start, create a new Windows Service Project:
Read more: Steve Smith