【发布时间】:2021-09-06 12:14:21
【问题描述】:
我有一个使用 Hangfire 的 .net 5 应用程序。
问题是,一旦应用程序完成启动,hangfire 服务器就会关闭。如果我在Startup.cs 的最后一行放置断点,则hangfire 服务器是活动的。
没有记录错误。
这可能是什么原因?
以下是用于添加 Hangfire 的代码。
public void ConfigureServices(IServiceCollection services)
{
services.AddHangfire(config =>
{
config.UseSqlServerStorage(configuration.GetConnectionString("HangfireDefaultConnection"), new SqlServer.SqlServerStorageOptions
{
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
QueuePollInterval = TimeSpan.Zero,
UseRecommendedIsolationLevel = true,
DisableGlobalLocks = true,
SchemaName = "dbo.WR_Hangfire",
});
});
....
}
public void Configure(IApplicationBuilder app)
{
...
app.UseHangfireServer();
...
}
【问题讨论】:
标签: hangfire