| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System;
- using System.Threading.Tasks;
- using Microsoft.Owin;
- using Owin;
- using Hangfire;
- using Hangfire.Dashboard;
- using Hangfire.Annotations;
- using Microsoft.Owin.Builder;
- using YTSoft.BaseCallCenter.MVCWeb.Controllers;
- [assembly: OwinStartup(typeof(YTSoft.BaseCallCenter.MVCWeb.Startup))]
- namespace YTSoft.BaseCallCenter.MVCWeb
- {
- public class Startup
- {
- public void Configuration(IAppBuilder app)
- {
- GlobalConfiguration.Configuration.UseSqlServerStorage("ConnectionString");
- //app.UseHangfireDashboard();
- app.UseHangfireDashboard("/hangfire", new DashboardOptions()
- {
- Authorization = new[] { new CustomAuthorizeFilter() }
- });
- app.UseHangfireServer(new BackgroundJobServerOptions()
- {
- Queues = new[] { "updatedata1" }
- });
- RecurringJob.AddOrUpdate<GetController>(a => a.Data(), Cron.Minutely, TimeZoneInfo.Local, "updatedata1");
-
- }
- public class CustomAuthorizeFilter : IDashboardAuthorizationFilter
- {
- public bool Authorize([NotNull] DashboardContext context)
- {
-
- return true;
- }
- }
- }
- }
|