Hangfire

Incredibly easy way to perform fire-and-forget, delayed and recurring tasks inside ASP.NET applications. No Windows Service required.

Backed by Redis, SQL Server, SQL Azure, MSMQ, RabbitMQ.

Fire and forget tasks

BackgroundJob.Enqueue(() => Console.WriteLine("Simple!"));

Delayed tasks

BackgroundJob.Schedule(() => Console.WriteLine("Reliable!"), TimeSpan.FromDays(7));

Recurring tasks

RecurringJob.AddOrUpdate(() => Console.WriteLine("Transparent!"), Cron.Daily);

Run them inside a web app…

Forget about AppDomain unloads, Web Garden & Web Farm issues – Hangfire is reliable for ASP.NET from scratch, even on Shared Hosting!

public void Configuration(IAppBuilder app)
{
    app.UseHangfire(cfg => cfg.UseServer());
}

… or anywhere else

In console application, Windows Service, Azure Worker Role, etc.

var server = new BackgroundJobServer();
server.Start();

Simple

Easy to setup, easy to configure. You don't need to run additional services or console programs for background job processing.

You can call regular static or instance .NET methods in background and pass arguments as usual.

Reliable

Background jobs are being deleted from the storage only on successful execution. Abruptly aborted jobs will be requeued after application restart.

Once a job was created, it will be performed at least once, even if the host process was terminated.

Designed for ASP.NET

Background tasks are being saved into a persistent storage and can survive the application pool recycling process.

You can run multiple instances of Hangfire Server, so Web Garden & Web Farm environments are fully supported.

Transparent

Watch the statistics, know the detailed history of job processing, manually retry or delete any job from the integrated web monitoring UI.

Plug in your logging framework to get notifications about problems in background job processing.

Scalable

Start with the simplest setup using SQL Server and grow your computational power by adding extra Hangfire Server instances either inside ASP.NET apps or use separate Windows Services.

Leverage multiple job storages to overcome the restrictions dictated by a single storage.

Extensible

Intercept the creation/performance/state change pipeline to add extra functionality using filters that are similar to ASP.NET MVC Filters.

Implement the support of persistent storage which is being used in your project environment – it is also abstracted.

Efficient

Although the default installation uses SQL Server and polling technique to fetch jobs, you can leverage MSMQ or Redis extensions to reduce the processing latency to minimum.

Self-maintainable

You don't need to manually clear the storage – Hangfire keeps it as clean as possible and removes old records automatically.

Open source

Hangfire is open source software and is completely free for commercial use. It is licensed under LGPLv3 license.

Fork the project and make contributions on GitHub!