diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/RecurringJobsExtensions.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/RecurringJobsExtensions.cs index 2be71511..0b60928f 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/RecurringJobsExtensions.cs +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/RecurringJobsExtensions.cs @@ -6,9 +6,7 @@ namespace Lion.AbpPro.Extensions.Hangfire { public static void CreateRecurringJob(this ApplicationInitializationContext context) { - using var scope = context.ServiceProvider.CreateScope(); - var testJob = scope.ServiceProvider.GetService(); - RecurringJob.AddOrUpdate("测试Job", () => testJob.ExecuteAsync(), CronType.Minute(1), TimeZoneInfo.Local); + RecurringJob.AddOrUpdate("测试Job", t => t.ExecuteAsync(), CronType.Minute(1),TimeZoneInfo.Local); } } } \ No newline at end of file