// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddHangfire(x => { var options = new Hangfire.SqlServer.SqlServerStorageOptions { PrepareSchemaIfNecessary = true }; x.UseSqlServerStorage(Configuration.GetConnectionString("ClassifiedAds"), options); }); }
public void Configuration(IAppBuilder app) { ConfigureAuth(app); var sqlServerOptions = new Hangfire.SqlServer.SqlServerStorageOptions() { InvisibilityTimeout = new TimeSpan(0, 120, 0) }; GlobalConfiguration.Configuration .UseSqlServerStorage("TourDB"); app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = Enumerable.Empty <IDashboardAuthorizationFilter>() }); app.UseHangfireServer(); RecurringJob.AddOrUpdate("SendBirthdayWishes", () => SendBirthdayWishes(), "0 12 * * *"); }