Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hangfire not running tasks although they are in database

Tags:

c#

hangfire

I'm not sure what's going on with Hangfire but calling BackgroundJob.Enqueue() adds a job to the database as "Scheduled" but nothing seems to happen. The method code does not seem to run. In the debugger no break points get hit and in my logs from inside job nothing gets printed.

 JobStorage.Current = new SqlServerStorage("DefaultConnection");
like image 715
parliament Avatar asked Oct 22 '14 06:10

parliament


1 Answers

I had a similar issue. In my case the problem was that my dependency injection wasn't properly wired up.

Only after I went to Hangfire Dashboard -> Scheduled Jobs and clicked on my job to see more details, I could see the exact exception messages i.e. "Couldn't create interface 'some_interface'".

Check if your jobs are initialised properly and that there are no errors in the 'Scheduled' part of Hangfire Dashboard.

like image 124
Jerry Avatar answered Sep 22 '22 21:09

Jerry