Hangfire

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

Backed by persistent storages. Open and free for commercial use.

Fire-and-forget tasks

// Static methods are for demo purposes
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.UseHangfireServer();
}

… or anywhere else

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

using (new BackgroundJobServer())
{
    /* ... */
}

Simple

Easy to set up, easy to use. No Windows Service, no Windows Scheduler, no separate applications required.

Background jobs are regular static or instance .NET methods with regular arguments – no base class or interface implementation required.

Persistent

Background jobs are saved into a persistent storage – SQL Server, Redis, PostgreSQL, MongoDB and others.

You can safely restart your application and use Hangfire with ASP.NET without worrying about application pool recycles.

Transparent

Built-in web interface allow you to see the whole picture of background processing as well as observe the state of each background job.

Out of the box support for popular logging frameworks allows you to catch errors early with zero configuration.

Reliable

Once a background job created and placed into a storage without exceptions, Hangfire takes the responsibility to process it at least once.

You are free to throw unhandled exceptions or kill your application – background jobs will be re-tried automatically.

Distributed

Background method calls and their arguments are serialized and may overcome the process boundaries.

You can use Hangfire on different machines to get more processing power with no configuration – synchronization is performed automatically.

Extensible

Job filters allow you to add custom features to the background processing in a way similar to ASP.NET MVC action filters.

Job storage access is fully abstracted and you can implement the support for your favorite storage. Dashboard supports modifications too.

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!