public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseHangfireDashboard("/BackgroundJobs", new DashboardOptions { DashboardTitle = "Eren Yýlmaz Hangfire Dashboard", //TITLE AppPath = "/weatherforecast" //BACK TO SITE }); //HANGFIRE SERVER CONFIGURATION app.UseHangfireServer(new BackgroundJobServerOptions() { //5 SANÝYEDE BÝR KONTROL ET SchedulePollingInterval = TimeSpan.FromSeconds(5) }); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); RecurringJobs.DatabaseBackupOperation(); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }); //app.UseHangfireDashboard(); app.UseHangfireDashboard("/ademolgunerhangfire", new DashboardOptions { DashboardTitle = "Adem Olguner Hangfire DashBoard", // Dashboard sayfasına ait Başlık alanını değiştiririz. AppPath = "/Home/HangfireAbout", // Dashboard üzerinden "back to site" button Authorization = new[] { new HangfireDashboardAuthorizationFilter() }, // Güvenlik için Authorization İşlemleri }); //app.UseHangfireServer(); app.UseHangfireServer(new BackgroundJobServerOptions { /* Hangfire Server, planlanan işleri sıralarına göre sıralamak için zamanlamayı düzenli olarak denetler ve * çalışanların bunları yürütmesine olanak tanır. * Varsayılan olarak, kontrol aralığı 15 saniyeye eşittir, ancak BackgroundJobServer yapıcısına ilettiğiniz seçeneklerde * SchedulePollingInterval özelliğini ayarlayarak değiştirebilirsiniz */ SchedulePollingInterval = TimeSpan.FromSeconds(30), //Arkaplanda çalışacak Job sayısını değiştirebiliriz. WorkerCount = Environment.ProcessorCount * 5 }); GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute { Attempts = 7 }); // Tanımlanan zaman diliminde sürekli çalıştığı için tetiklenmesine gerek yok, // burada tanımlayabiliriz. tanımlayabiliriz. RecurringJobs.DatabaseBackupOperation(); }