地铁二期项目正式开始

Startup.cs 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Threading.Tasks;
  3. using Microsoft.Owin;
  4. using Owin;
  5. using Hangfire;
  6. using Hangfire.Dashboard;
  7. using Hangfire.Annotations;
  8. using Microsoft.Owin.Builder;
  9. using YTSoft.BaseCallCenter.MVCWeb.Controllers;
  10. [assembly: OwinStartup(typeof(YTSoft.BaseCallCenter.MVCWeb.Startup))]
  11. namespace YTSoft.BaseCallCenter.MVCWeb
  12. {
  13. public class Startup
  14. {
  15. public void Configuration(IAppBuilder app)
  16. {
  17. GlobalConfiguration.Configuration.UseSqlServerStorage("ConnectionString");
  18. //app.UseHangfireDashboard();
  19. app.UseHangfireDashboard("/hangfire", new DashboardOptions()
  20. {
  21. Authorization = new[] { new CustomAuthorizeFilter() }
  22. });
  23. app.UseHangfireServer(new BackgroundJobServerOptions()
  24. {
  25. Queues = new[] { "updatedata1" }
  26. });
  27. RecurringJob.AddOrUpdate<GetController>(a => a.Data(), Cron.Minutely, TimeZoneInfo.Local, "updatedata1");
  28. }
  29. public class CustomAuthorizeFilter : IDashboardAuthorizationFilter
  30. {
  31. public bool Authorize([NotNull] DashboardContext context)
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. }