A small library help to simplify the creation of Windows Service application.
Unlike windows service project, Baki allows your application to be easily tested and debuged just like regular console application. Baki also embed the install/uninstall windows service without having to create a separate install project.
-
Create a console project
-
On Package Manager Console, type:
install-package baki
-
Register host class in Program.cs
class Program { static void Main(string[] args) { WindowsService.Run<Host>(args); } }
-
Create a console project
-
Reference Baki.dll
-
Create a windows service host class
class Host : IWindowsServiceHost { public void Start() { //your code goes here Console.Writeline("Service Started"); } public void Stop() { Console.Writeline("Service Stopped"); } }
-
Register host class in Program.cs
class Program { static void Main(string[] args) { WindowsService.Run<Host>(args); } }
##Note Baki is insipired by TopShelf. Topshelf is my recommended windows service framework if your application requires feature like shelving
Baki (bah key), means serving tray in Manado (dialek) language.