feat 增加hangfire账户密码
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Hangfire;
|
using Hangfire;
|
||||||
|
using Hangfire.Dashboard.BasicAuthorization;
|
||||||
using Hangfire.MySql;
|
using Hangfire.MySql;
|
||||||
using Kurisu.AspNetCore.Startup;
|
using Kurisu.AspNetCore.Startup;
|
||||||
|
|
||||||
@@ -28,8 +29,24 @@ namespace Dlhis.ScheduledTask
|
|||||||
|
|
||||||
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
|
//支持可视化界面 ---任何一个用户都能够来访问;所以需要加一道屏障
|
||||||
|
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
||||||
|
{
|
||||||
|
Authorization = new BasicAuthAuthorizationFilter[] {
|
||||||
|
new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions(){
|
||||||
|
SslRedirect=false,
|
||||||
|
RequireSsl=false,
|
||||||
|
Users=new BasicAuthAuthorizationUser[]{
|
||||||
|
new BasicAuthAuthorizationUser(){
|
||||||
|
Login="admin",
|
||||||
|
PasswordClear="admin"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
app.UseHangfireDashboard(); //使用hangfire面板
|
app.UseHangfireDashboard(); //使用hangfire面板
|
||||||
//app.UseHangfireServer(); //启动hangfire服务
|
|
||||||
|
|
||||||
BackgroundJob.Enqueue(() => Console.WriteLine("This is a background job."));
|
BackgroundJob.Enqueue(() => Console.WriteLine("This is a background job."));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user