Tutorial – Building a Windows Service application in C#

In this post I will explain how to build a Windows Service application which (for debug purposes) could also be started as a Windows Console application using the .NET Framework 2.0 or higher. The source code of the application can be downloaded here.

During the course of this article we will construct a small application which will leave a message in the Windows Event Log every minute. The application is of course completely useless, however it demonstrates how to construct a Windows Service application which could also be started as a Windows Console application. Leaving messages in the Windows Event Log also makes it easy for us to see if the application is working correctly when running as a Windows Service. Continue reading