在AbpZero中hangfire后台作业的使用——开启hangfire

    AbpZero框架已经集成了hangfire,但它默认是关闭的,我们可以在运行站点下的Startup.cs文件中把这行代码注释取消就行了,代码如下:

            //Hangfire (Enable to use Hangfire instead of default job manager)
            services.AddHangfire(config =>
            {
                config.UseSqlServerStorage(_appConfiguration.GetConnectionString("Default"));

            });

 

        //Hangfire dashboard & server (Enable to use Hangfire instead of default job manager)
  app.UseHangfireDashboard("/hangfire", new DashboardOptions
  {
  // Authorization = new[] { new AbpHangfireAuthorizationFilter(AppPermissions.Pages_Administration_HangfireDashboard) }
  Authorization = new[] { new CustomAuthorizeFilter() }
  });
   app.UseHangfireServer();

   运行swagger后,把链接改为:http://localhost:22742/hangfire,即可调出hangfire后台作业管理页面。

posted @ 2018-05-30 12:07  老李的自我救赎之路。  阅读(1030)  评论(0编辑  收藏  举报