Asp.net core 如何在控制台应用程序中配置hangfire仪表板?
我正在使用hangfire nuget包来计划asp.net核心控制台应用程序中的作业 我尝试了将仪表板配置为控制台应用程序的所有方法 如何从控制台应用程序托管网页 我已经为仪表板配置创建了startup.cs类Asp.net core 如何在控制台应用程序中配置hangfire仪表板?,asp.net-core,console-application,hangfire,Asp.net Core,Console Application,Hangfire,我正在使用hangfire nuget包来计划asp.net核心控制台应用程序中的作业 我尝试了将仪表板配置为控制台应用程序的所有方法 如何从控制台应用程序托管网页 我已经为仪表板配置创建了startup.cs类 using Hangfire; using Microsoft.AspNetCore.Builder; namespace PulsarHangFire { public class Startup { publ
using Hangfire;
using Microsoft.AspNetCore.Builder;
namespace PulsarHangFire
{
public class Startup
{
public void Configuration(IApplicationBuilder app)
{
app.UseHangfireDashboard("/hangfire");
app.UseHangfireServer();
}
}
}
有谁能告诉我如何继续创建Startup.cs文件(或从.NET Core Web App模板获取文件)并配置以下内容:
public void ConfigureServices(IServiceCollection services)
{
// ... other required services ...
services.AddHangfire(configuration =>
{
// Do pretty much the same as you'd do with
// GlobalConfiguration.Configuration in classic .NET
// NOTE: logger and activator would be configured automatically,
// and in most cases you don't need to configure those.
configuration.UseSqlServerStorage(...);
// ... maybe something else, e.g. configuration.UseConsole()
});
}
最后添加Hangfire仪表板:
public void Configure(IApplicationBuilder app, IRecurringJobManager recurringJobManager)
{
// ... previous pipeline stages, e.g. app.UseAuthentication()
app.UseHangfireDashboard(...);
// ... next pipeline stages, e.g. app.UseMvc()
// then you may configure your recurring jobs here:
recurringJobManager.AddOrUpdate(...);
}