using Neo.Afx.Services; using Topshelf; namespace Neo.LegitimateLicences.WinService { internal static class ConfigureService { internal static void Configure() { HostFactory.Run(configure => { configure.Service(service => { service.ConstructUsing(s => new DatabaseServiceScheduler()); service.WhenStarted(s => s.Start()); service.WhenStopped(s => s.Stop()); }); //Setup Account that window service use to run. configure.RunAsLocalSystem(); configure.SetServiceName("DatabaseServiceScheduler"); configure.SetDisplayName("DatabaseServiceScheduler"); configure.SetDescription("My .Net windows service with Topshelf"); }); } } }