Задания Hangfire работают со старой версией кода?

#hangfire #cron-task

Вопрос:

Мой hangfire, похоже, запускает старые версии моего кода. в журналах говорится:

 fail: Hangfire.AutomaticRetryAttribute[0]
      Failed to process the job '14549': an exception occurred.
      System.InvalidOperationException: Unable to resolve service for type 'Aftermarket.Server.Common.PqatExport.PQATRepository' while attempting to activate 'Aftermarket.Server.Common.PqatExport.PQATExportHandler'.
         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetServiceOrCreateInstance(IServiceProvider provider, Type type)
         at Hangfire.AspNetCore.AspNetCoreJobActivatorScope.Resolve(Type type)
         at Hangfire.Server.CoreBackgroundJobPerformer.Perform(PerformContext context)
         at Hangfire.Server.BackgroundJobPerformer.<>c__DisplayClass9_0.<PerformJobWithFilters>b__0()
         at Hangfire.Server.BackgroundJobPerformer.InvokePerformFilter(IServerFilter filter, PerformingContext preContext, Func`1 continuation)
         at Hangfire.Server.BackgroundJobPerformer.<>c__DisplayClass9_1.<PerformJobWithFilters>b__2()
         at Hangfire.Server.BackgroundJobPerformer.PerformJobWithFilters(PerformContext context, IEnumerable`1 filters)
         at Hangfire.Server.BackgroundJobPerformer.Perform(PerformContext context)
         at Hangfire.Server.Worker.PerformJob(BackgroundProcessContext context, IStorageConnection connection, String jobId)
warn: Hangfire.AutomaticRetryAttribute[0]
      Failed to process the job '14553': an exception occurred. Retry attempt 8 of 10 will be performed in 00:43:52.
      System.InvalidOperationException: Unable to resolve service for type 'Aftermarket.Server.Common.PQAT_Export.HwsPQATExport.HwsPQATRepository' while attempting to activate 'Aftermarket.Server.Common.PQAT_Export.HwsPQATExport.HwsPQATExportHandler'.
         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetServiceOrCreateInstance(IServiceProvider provider, Type type)
         at Hangfire.AspNetCore.AspNetCoreJobActivatorScope.Resolve(Type type)
         at Hangfire.Server.CoreBackgroundJobPerformer.Perform(PerformContext context)
         at Hangfire.Server.BackgroundJobPerformer.<>c__DisplayClass9_0.<PerformJobWithFilters>b__0()
         at Hangfire.Server.BackgroundJobPerformer.InvokePerformFilter(IServerFilter filter, PerformingContext preContext, Func`1 continuation)
         at Hangfire.Server.BackgroundJobPerformer.<>c__DisplayClass9_1.<PerformJobWithFilters>b__2()
         at Hangfire.Server.BackgroundJobPerformer.PerformJobWithFilters(PerformContext context, IEnumerable`1 filters)
         at Hangfire.Server.BackgroundJobPerformer.Perform(PerformContext context)
         at Hangfire.Server.Worker.PerformJob(BackgroundProcessContext context, IStorageConnection connection, String jobId)
warn: Hangfire.AutomaticRetryAttribute[0]
      Failed to process the job '14555': an exception occurred. Retry attempt 3 of 10 will be performed in 00:00:52.
      System.InvalidOperationException: Unable to resolve service for type 'Aftermarket.Server.Common.PqatExport.PQATRepository' while attempting to activate 'Aftermarket.Server.Common.PqatExport.PQATExportHandler'.
         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetServiceOrCreateInstance(IServiceProvider provider, Type type)
         at Hangfire.AspNetCore.AspNetCoreJobActivatorScope.Resolve(Type type)
         at Hangfire.Server.CoreBackgroundJobPerformer.Perform(PerformContext context)
         at Hangfire.Server.BackgroundJobPerformer.<>c__DisplayClass9_0.<PerformJobWithFilters>b__0()
         at Hangfire.Server.BackgroundJobPerformer.InvokePerformFilter(IServerFilter filter, PerformingContext preContext, Func`1 continuation)
         at Hangfire.Server.BackgroundJobPerformer.<>c__DisplayClass9_1.<PerformJobWithFilters>b__2()
         at Hangfire.Server.BackgroundJobPerformer.PerformJobWithFilters(PerformContext context, IEnumerable`1 filters)
         at Hangfire.Server.BackgroundJobPerformer.Perform(PerformContext context)
         at Hangfire.Server.Worker.PerformJob(BackgroundProcessContext context, IStorageConnection connection, String jobId)
warn: Hangfire.AutomaticRetryAttribute[0]
      Failed to process the job '14555': an exception occurred. Retry attempt 5 of 10 will be performed in 00:05:31.
      System.InvalidOperationException: Unable to resolve service for type 'Aftermarket.Server.Common.PqatExport.PQATRepository' while attempting to activate 'Aftermarket.Server.Common.PqatExport.PQATExportHandler'.
         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetServiceOrCreateInstance(IServiceProvider provider, Type type)
         at Hangfire.AspNetCore.AspNetCoreJobActivatorScope.Resolve(Type type)
         at Hangfire.Server.CoreBackgroundJobPerformer.Perform(PerformContext context)
         at Hangfire.Server.BackgroundJobPerformer.<>c__DisplayClass9_0.<PerformJobWithFilters>b__0()
         at Hangfire.Server.BackgroundJobPerformer.InvokePerformFilter(IServerFilter filter, PerformingContext preContext, Func`1 continuation)
         at Hangfire.Server.BackgroundJobPerformer.<>c__DisplayClass9_1.<PerformJobWithFilters>b__2()
         at Hangfire.Server.BackgroundJobPerformer.PerformJobWithFilters(PerformContext context, IEnumerable`1 filters)
         at Hangfire.Server.BackgroundJobPerformer.Perform(PerformContext context)
         at Hangfire.Server.Worker.PerformJob(BackgroundProcessContext context, IStorageConnection connection, String jobId)
 

Но я давно удалил все, что имеет отношение к PQATExport из класса startup.cs ??
Это похоже на то, что Hangfire пытается запустить старый код, который удален? Как мне это исправить?

Комментарии:

1. Похоже, что давным-давно вы запланировали повторяющееся задание, адресованное PQATExport, и на это задание все еще есть ссылка в базе данных Hangfire. Вам нужно его удалить.

2. Так оно и было! Спасибо!