private void Install() { Console.Out.WriteLine("Installing service {0}", _serviceName); var location = Assembly.GetExecutingAssembly().Location; Log.Debug($"ServiceConsoleCommand:RunCommand {location}"); ServiceInstaller.InstallAndStart(_serviceName, null, $@"{location} {AsServiceArgument}"); Console.Out.WriteLine("Service {0} is now installed.", _serviceName); }
private void Stop() { Console.Out.WriteLine("Stop service {0}.", _serviceName); ServiceInstaller.StopService(_serviceName); }
private void IsInstalled() { var serviceIsInstalled = ServiceInstaller.ServiceIsInstalled(_serviceName); Console.Out.WriteLine("Service {1} is installed : {0}.", serviceIsInstalled, _serviceName); }
private void RemoveService() { Console.Out.WriteLine("Remove service {0}.", _serviceName); ServiceInstaller.Uninstall(_serviceName); }
private void Status() { Console.Out.WriteLine("Service status of {0}.", _serviceName); ServiceInstaller.GetServiceStatus(_serviceName); }