Hangfire icon indicating copy to clipboard operation
Hangfire copied to clipboard

Could not load file or assembly 'Hangfire.Core, Version=xxx

Open imarrero opened this issue 6 years ago • 4 comments

Hello!

Version of Hangfire.Core: 1.6.19.0 Storage package: Hangfire.SqlServer Configuration logic: Asp .Net core 2.0 What happen: 1.- Website cannot start ( not /hangfire, not my website home) with the generic error: "An error has ocurred" 2.- stdlogs records:

[18:00:37 FTL] Application startup exception System.IO.FileNotFoundException: Could not load file or assembly 'Hangfire.Core, Version=1.6.19.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. File name: 'Hangfire.Core, Version=1.6.19.0, Culture=neutral, PublicKeyToken=null' at AIWeb.UI.Startup.ConfigureServices(IServiceCollection services) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services) at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices() at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

How to reproduce: Bug is thrown when deploying on a new enviroment (IIS) (no database created yet) and defining custom queues like this in startup:

            app.UseResponseCompression();
            app.UseHangfireDashboard();
            var options = new BackgroundJobServerOptions
            {
                Queues = new[] { "default", "system" }
            };
            app.UseHangfireServer(options);
  • Error "Hangfire.Core.dll not found" is thrown. (Of course the assembly was correctly deployed )

How I fixed it: 1.- I removed the the options 2.- Deploy again 3.- Worked (and NOW SqlServer tables were created) 4.- Put back my options 5.- Deploy again 6.- Everything works now and custom queues are available / shown in /hangfire/servers

I hope it helps. Thanks

imarrero avatar May 24 '18 12:05 imarrero

I'm also having this issue!

Versions

asp.net core 2.1 Hangfire.AspNetCore 1.6.21 Hangfire.SqlServer 1.6.21

The error

afbeelding

koenverburg avatar Jan 08 '19 09:01 koenverburg

I am having the very same issue with a .Net Core 3.1 / Hangfire 1.7.22 ... did anyone ever figure out where this is coming from / how to work around it?

joergbattermann avatar Jun 04 '21 12:06 joergbattermann

Hi I am getting this error.. Any one can help me Please.

System.InvalidOperationException: Recurring job can't be scheduled, see inner exception for details. ---> Hangfire.Common.JobLoadException: Could not load the job. See inner exception for the details. ---> System.TypeLoadException: Could not load type 'MyApplication.Hangfire.MyJob' from assembly 'MyApplication.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. at System.Reflection.RuntimeAssembly.GetType(QCallAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive, ObjectHandleOnStack assemblyLoadContext) at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) at Hangfire.Common.TypeHelper.TypeResolver(Assembly assembly, String typeName, Boolean ignoreCase) at System.TypeNameParser.ResolveType(Assembly assembly, String[] names, Func`4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark)

DIVYPRAKASHMALL avatar Sep 04 '23 08:09 DIVYPRAKASHMALL

I started getting this issue today, everything was previously working, I deployed a new version of the website to the server and it now throws this error, I'm using 1.8.12 it all wors fine locally though so not sure what has broken it

huwred avatar Apr 04 '24 17:04 huwred