static void Main(string[] args) { Console.Clear(); Console.Title = "Ethereum Web Job - Ver. " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; var settings = GetSettings(); if (settings == null) { Console.WriteLine("Press any key to exit..."); Console.ReadKey(); return; } try { CheckSettings(settings); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); return; } Console.WriteLine("Settings checked!"); var container = UnityConfig.InitContainer(settings); try { JobFactory.RunJobs(container); } catch (Exception e) { Console.WriteLine("cannot start jobs! Exception: " + e.Message); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); return; } Console.WriteLine("Web job started"); Console.WriteLine("Utc time: " + DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss")); Console.WriteLine("Press 'q' to quit."); while (Console.ReadLine() != "q") { continue; } }
static void Main(string[] args) { Console.Clear(); Console.Title = "Ethereum Web Job - Ver. " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; var settings = GetSettings(); if (settings == null) { Console.WriteLine("Press any key to exit..."); Console.ReadKey(); return; } var container = new UnityConfig(); container.InitContainer(settings); var config = new JobHostConfiguration { JobActivator = container, StorageConnectionString = settings.Db.JobStorageConnString, DashboardConnectionString = settings.Db.JobStorageConnString, Tracing = { ConsoleLevel = TraceLevel.Error } }; #if DEBUG config.HostId = "developmenthost"; config.UseDevelopmentSettings(); #endif config.UseTimers(); Console.WriteLine("Web job started"); var host = new JobHost(config); host.RunAndBlock(); }