static void Main() { using (var service = new NancyService()) { if (Environment.UserInteractive) { service.OnStart(null); Console.Write("Press any key to stop program"); Console.Read(); service.OnStop(); } else { Run(service); } } }