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 (I recently tested this with .NET Framework 4.5.2, the article below is still applicable). The source code of the application is available on GitHub.

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 Tutorial – Building a Windows Service application in C#