Creating windows services can be a tricky task. Debugging problems can be difficult and deploy usually is a headache. Topshelf simplifies all these activities.
Why to create a Windows service?
When we want our application running in background, continuously, without worrying about which user is logged in or even risk someone accidentally closing it, a good solution is to create this application as a windows service.
Windows services can automatically start on boot. In addition, recovery policies can be set if problems occur.
What is Topshelf?
Topshelf is an open source framework that makes easy to develop Windows services. With Topshelf we can develop and debug Windows services just as easily as we develop and debug a Console Application. In addition, it also simplifies deploy.
Without Topshelp, we would need to worry about using utilities to install services and make debugger attachment to debugging.
Step-by-step to create a windows service with Topshelf
Creating
The easiest way to create a Windows service, using Topshelf, is to start by creating an Application Console. Then just add the Topshelf package as a Nuget reference.