HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.41k stars 1.7k forks source link

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

Open imarrero opened 6 years ago

imarrero commented 6 years ago

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);

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

koenverburg commented 5 years ago

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

joergbattermann commented 3 years ago

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?

DIVYPRAKASHMALL commented 1 year ago

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)

huwred commented 7 months ago

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