public static void Main(string[] args) { WindowsService.Install( new Log4netLogStrategy("JobSharpLog"), c => { c.RunAsLocalSystem(); c.SetDescription("A very simple JobSharp Sample"); c.SetDisplayName("JobSharp Sample"); c.SetServiceName("JobSharpSample"); c.StartAutomatically(); c.EnableShutdown(); }); }
public void WindowsService(bool start, bool install, bool remove) { if (start) { ServiceBase.Run(_service); } else if (install) { _service.Install(); } else if (remove) { _service.Uninstall(); } else { throw new CommandParameterInvalidException("You must specify at least one option"); } }