private static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; if (Environment.UserInteractive) { var service = new DnsCheckerService(); service.StartDaemon(); Console.ReadKey(); } else { ServiceBase.Run(new DnsCheckerService()); } }
private static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; if (Environment.UserInteractive || args.Any()) { var options = new Options(); if (CommandLine.Parser.Default.ParseArgumentsStrict(args, options, () => Console.WriteLine("Bad command line parameters."))) { var service = new DnsCheckerService(); service.StartConsole(); } } else { ServiceBase.Run(new DnsCheckerService()); } }