From e31801af57286e245e3b2c96ae2cdcd044901331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=86=9B?= <510423039@qq.com> Date: Wed, 24 May 2023 20:29:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4Job=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/Hangfire/RecurringJobsExtensions.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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