Questions tagged [hangfire]

Hangfire is an open-source framework that helps you to create, process and manage your background jobs in .NET Framework and .NET Core.

Hangfire is an open-source framework that helps you to create, process and manage your background jobs in .NET Framework and .NET Core.:

  • mass notifications/newsletter
  • batch import from xml, csv, json
  • creation of archives
  • firing off web hooks
  • deleting users
  • building different graphs
  • image/video processing
  • purge temporary files
  • recurring automated reports
  • database maintenance

Background job type support:

  • Single use
  • Delayed
  • Recurring
  • Continuations

Persistent Storage via SQLServer, Redis, PostgreSQL, mongoDB or CompositeC1.

Hangfire is a .NET Framework alternative to Sidekiq, Resque, and delayed_job.

http://hangfire.io/

1297 questions
89
votes
9 answers

Hangfire dependency injection with .NET Core

How can I use .NET Core's default dependency injection in Hangfire? I am new to Hangfire and searching for an example which works with ASP.NET Core.
eadam
  • 23,151
  • 18
  • 48
  • 71
50
votes
5 answers

Disable re-queueing of failed Hangfire BackgroundJob

Is there a way to disable re-queueing of a failed Hangfire BackgroundJob? We do not want the failed jobs to be executed again as this might cause issues.
user2992766
  • 1,156
  • 1
  • 8
  • 14
47
votes
7 answers

Hangfire recurring tasks under minute

Is there a way to set hangfire recurring jobs every few seconds? I do not seek a solution where fire and forget task creates another fire and forget task, and if not, what are suggested alternatives?
Robert
  • 3,353
  • 4
  • 32
  • 50
45
votes
3 answers

How to remove all hangfire recurring jobs on startup?

I am looking at using Hangfire as a job scheduler for recurring jobs. So configuring them is simple with AddOrUpdate, but then how do i delete it? I don't want to pollute my code with RecurringJob.RemoveIfExists() when that job has been deleted and…
lahsrah
  • 9,013
  • 5
  • 37
  • 67
44
votes
1 answer

How to invoke async methods in Hangfire?

I have asp.net core API application and this is the first time i will be using HangFire. In .Net Core application all my methods are async. Based on SO Post it's not good idea to use wait() while calling async method in hangfire. Also as per the…
LP13
  • 30,567
  • 53
  • 217
  • 400
43
votes
5 answers

Is there an in memory job storage package for Hangfire?

I have a console application to test HangFire. Here is the code: using System; using Hangfire; namespace MyScheduler.ConsoleApp { internal static class Program { internal static void Main(string[] args) { …
Lost_In_Library
  • 3,265
  • 6
  • 38
  • 70
33
votes
4 answers

Configure cron job that is executing every 15 minutes on Hangfire

I am using Hangfire and like the software very much! But one thing I am missing is how to add a recurring job that executes every few minutes (e.g. every 15 minutes). Is there a way to achieve this?
Nikolay Kostov
  • 16,433
  • 23
  • 85
  • 123
32
votes
1 answer

Hangfire DisableConcurrentExecution: What happens when the timeout expires?

Per the Hangfire 0.8.2 announcement post, Hangfire has a DisableConcurrentExecution filter which, when applied to a method, prevents multiple instances of the method from executing concurrently. The DisableConcurrentExecution filter takes a…
Jon Schneider
  • 25,758
  • 23
  • 142
  • 170
28
votes
6 answers

How can I safely reset Hangfire to a clean state?

I have a server with Hangfire installed. I haven't checked it for a while and it seems one recurring job has gone rogue. It stopped working and then it has stacked up with retries resulting in a complete lock it seems. I would like to clear my…
Ogglas
  • 62,132
  • 37
  • 328
  • 418
27
votes
4 answers

Hangfire CRON in UTC time

I am trying to configure a recurring task in my MVC application starting at 00:00 every day. I know this can be achieved by RecurringJob.AddOrUpdate(() => Console.Write("Easy!"), Cron.Daily);. Now my question is does hangfire cron work on basis of…
Anas Shahid
  • 353
  • 2
  • 5
  • 10
25
votes
5 answers

Hangfire dependency injection lifetime scope

I'm rewriting this entire question because I realize the cause, but still need a solution: I have a recurring job in Hangfire that runs every minute and check the database, possibly updates some stuff, then exits. I inject my dbcontext into the…
parliament
  • 21,544
  • 38
  • 148
  • 238
23
votes
8 answers

Hangfire - Prevent multiples of the same job being enqueued

Scenario: Job 1 is scheduled to run every 5 minutes, and takes ~1 minute to complete. A lot of work piles up and Job 1 takes 15 minutes to run. There are now three Job 1's being processed concurrently - I don't want this. How do I prevent Job 1…
Jaywaa
  • 373
  • 1
  • 4
  • 11
21
votes
6 answers

JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API

I am using hangfire in mvc application. I am sending reminder to user for his/her appointment. I have installed hangfire in my app. I have configured hangfire in startup.cs class. But when i run the app, it produce the below error, JobStorage.…
Ali
  • 417
  • 1
  • 6
  • 16
20
votes
2 answers

How to create cron expression for Hangfire job that executes everyday at some time

I am new to cron expression. All i need to know that how to create cron for recurring job in Hangfire that executes after every 1 day at 5 pm, 1 am, 2:45 pm Understanding that Hangfire also accepts standard Cron expression, I've tried exploring Cron…
Manohar Thakur
  • 313
  • 1
  • 2
  • 9
20
votes
1 answer

Hangfire configuration and Ninject configuration

I have an MVC 5 application which uses Ninject and I am adding Hangfire to it. When I have added Ninject, I have used the NinjectWebCommon nuget package because of its simplicity in the configuration. So for now Ninject is configured through the…
Lorenzo
  • 29,081
  • 49
  • 125
  • 222
1
2 3
86 87