Hangfire not running tasks although they are in database

parliament picture parliament · Oct 22, 2014 · Viewed 9.1k times · Source

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

Answer

Jerry picture Jerry · Oct 24, 2014

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.