static void Main(string[] args) { var environmentName = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{environmentName}.json", true, true) .Build(); Task.Run(() => { JobLauncher.Launch(configuration); var random = new Random(10); while (true) { Thread.Sleep(1000); } }); Console.CancelKeyPress += (o, e) => { Console.WriteLine("Exit"); waitHandle.Set(); }; waitHandle.WaitOne(); }
static void Main(string[] args) { var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .Build(); JobLauncher.Launch(configuration); Console.WriteLine("Press Enter to quit the application !"); Console.ReadLine(); }