public static void ServiceMain(string[] args) { log4net.Config.XmlConfigurator.Configure(); if (args.Length == 1) { switch (args[0].ToLower()) { case "-install": QuartzServiceInstaller.InstallService(); break; case "-uninstall": StopIt(); QuartzServiceInstaller.UninstallService(); break; default: throw new NotImplementedException(); } } else { if (!Environment.UserInteractive) { // running as service using (var service = new Service()) ServiceBase.Run(service); } else { // running as console app try { Start(args); Console.WriteLine("Press any key to stop..."); Console.ReadKey(true); StopIt(); } catch (Exception ex) { _log.Error(ex); } } } }
public void UnInstall() { StopIt(); QuartzServiceInstaller.UninstallService(); }