public static void Main(string[] args) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json"); var config = builder.Build(); var dbBuilder = new DbContextOptionsBuilder <TextContext>(); dbBuilder.UseSqlite("Data Source=" + config["ConnectionStrings:SQLiteTextDb"]); dbName = config["ConnectionStrings:SQLiteTextDb"]; var textContext = new TextContext(dbBuilder.Options); JobStorage.Current = new SQLiteStorage(config["ConnectionStrings:SQLiteHangfire"]); // Create DB with test data. CreateDbWithTestData(textContext); // Split Texts after seeding. //BackgroundTasks.SplitNewTexts(textContext); // Create Background Task for new texts. Task.Factory.StartNew(() => { Log.SeqLog.WriteNewLogMessage("Createing background job Split new texts."); //BackgroundJob.Enqueue( // () => BackgroundTasks.SplitNewTexts(config["ConnectionStrings:SQLiteTextDb"])); RecurringJob.AddOrUpdate( () => BackgroundTasks.SplitNewTexts(config["ConnectionStrings:SQLiteTextDb"]), Cron.MinuteInterval(5)); }); BuildWebHost(args).Run(); }