Closed zxyao145 closed 3 years ago
问题描述: 任务在执行成功后一直处于执行中状态,debug时可以看到确实执行完毕,且未抛出异常。
代码结构:
[TransientJob] public class AlertJob:JobAgent { private readonly ILogger<AlertJob> _logger; private readonly IAlertCalcService _alertCalcService; public AlertJob( ILogger<AlertJob> logger, IAlertCalcService alertCalcService ) { _logger = logger; _alertCalcService = alertCalcService; } public override async Task OnStart(JobContext jobContext) { await AlertCalcJob(); } public async Task AlertCalcJob() { _logger.LogInformation("AlertCalcJob"); await _alertCalcService.RunAsync(); } }
相关环境: -- NET 5.0
-- 调度端依赖 <PackageReference Include="Hangfire.AspNetCore" Version="1.7.18" /> <PackageReference Include="Hangfire.HttpJob" Version="3.4.9" /> <PackageReference Include="Hangfire.HttpJob.Client" Version="1.2.1" /> <PackageReference Include="Hangfire.PostgreSql" Version="1.8.0" /> <PackageReference Include="Hangfire.RecurringJobAdmin" Version="1.0.5" /> <PackageReference Include="Hangfire.RecurringJobExtensions" Version="1.1.6" /> <PackageReference Include="HangFire.Redis.StackExchange" Version="1.8.4" />
-- Agent端依赖 <PackageReference Include="Hangfire.HttpJob.Agent" Version="1.3.3" />
请查看一下agent端是否可以连接到hangfire的storage
看你的引用只有agent并没有按照wiki来,wiki说明了要么你用mysql 或者 sqlserver或者redis的agent nuget包,你再看看wiki
这个是新增的吗?以前使用NET Core 3的时候没问题,最近升级了发现无法使用了
我的demo你看下
新版有点变化了,变得更好了。你可以看看wiki
问题描述: 任务在执行成功后一直处于执行中状态,debug时可以看到确实执行完毕,且未抛出异常。
代码结构:
相关环境: -- NET 5.0
-- 调度端依赖 <PackageReference Include="Hangfire.AspNetCore" Version="1.7.18" /> <PackageReference Include="Hangfire.HttpJob" Version="3.4.9" /> <PackageReference Include="Hangfire.HttpJob.Client" Version="1.2.1" /> <PackageReference Include="Hangfire.PostgreSql" Version="1.8.0" /> <PackageReference Include="Hangfire.RecurringJobAdmin" Version="1.0.5" /> <PackageReference Include="Hangfire.RecurringJobExtensions" Version="1.1.6" /> <PackageReference Include="HangFire.Redis.StackExchange" Version="1.8.4" />
-- Agent端依赖 <PackageReference Include="Hangfire.HttpJob.Agent" Version="1.3.3" />