An easy way to perform fire-and-forget, delayed and recurring tasks inside ASP.NET apps
C# Other
Pull request Compare This branch is 14 commits ahead, 843 commits behind HangfireIO:master.
Latest commit ea582af Oct 19, 2016 @vip32 committed on GitHub Update
Failed to load latest commit information.
.nuget Update package to 1.3.4 May 6, 2015
samples sqlite project added + nugets Jun 30, 2015
src package updates Jul 31, 2015
tests package updates Jul 31, 2015
.editorconfig Replace tabs with spaces in psake-project.ps1 Mar 19, 2015
.gitignore Use OpenCover and Mar 2, 2015
.travis.yml Fix paths to tests for travis again Mar 2, 2015
COPYING.LESSER LGPL v3 license text Nov 10, 2013
Hangfire.Mono.sln Update Hangfire.Mono.sln Dec 5, 2014
Hangfire.sln package updates Jul 31, 2015
Hangfire.sln.DotSettings Update Oct 19, 2016
appveyor.yml Bump version to 1.4.3 May 27, 2015
psake-project.ps1 Fix version detection on AppVeyor Apr 9, 2015

Hangfire.SQLite (unfinished, not production ready)

Official Site Latest version Build status Build Status Coverage Status License LGPLv3

This repo will add a SQLite storage provider for Hangfire.

Incredibly easy way to perform fire-and-forget, delayed and recurring jobs inside ASP.NET applications. CPU and I/O intensive, long-running and short-running jobs are supported. No Windows Service / Task Scheduler required. Backed by Redis, SQL Server, SQL Azure or MSMQ.

Hangfire provides unified programming model to handle background tasks in a reliable way and run them on shared hosting, dedicated hosting or in cloud. You can start with a simple setup and grow computational power for background jobs with time for these scenarios:

  • 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;
  • …and so on.

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

Hangfire Dashboard


Hangfire is available as a NuGet package. So, you can install it using the NuGet Package Console window:

PM> Install-Package Hangfire

After install, update your existing OWIN Startup file with the following lines of code. If you do not have this class in your project or don't know what is it, please read the Quick start guide to learn about how to install Hangfire.

public void Configuration(IAppBuilder app)
    GlobalConfiguration.Configuration.UseSqlServerStorage("<connection string or its name>");



This is incomplete list of features, to see all of them, check the official site and the documentation.

Fire-and-forget tasks

Enqueued background jobs are being executed inside a dedicated worker pool threads as soon as possible, shortening your request processing time.

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

Delayed tasks

Scheduled background jobs are being executed only after given amount of time.

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

Recurring tasks

Recurring jobs were never been simpler, just call the following method to perform any kind of recurring task using the CRON expressions.

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


Continuations allow you to define complex workflows by chaining multiple background jobs together.

var id = BackgroundJob.Enqueue(() => Console.WriteLine("Hello, "));
BackgroundJob.ContinueWith(id, () => Console.WriteLine("world!"));

Process them inside a web application…

You can process background tasks in any OWIN compatible application frameworks, including ASP.NET MVC, ASP.NET Web API, FubuMvc, Nancy, etc. Forget about AppDomain unloads, Web Garden & Web Farm issues – Hangfire is reliable for web applications from scratch, even on shared hosting.


… or anywhere else

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

using (new BackgroundJobServer())
    Console.WriteLine("Hangfire Server started. Press ENTER to exit...");

Questions? Problems?

Open-source project are developing more smoothly, when all discussions are held in public.

If you have any questions, problems related to the Hangfire usage or want to discuss new features, please visit the discussion forum. You can sign in there using your existing Google or GitHub account, so it's very simple to start using it.

If you've discovered a bug, please report it to the Hangfire GitHub Issues. Detailed reports with stack traces, actual and expected behavours are welcome.

Related Projects

Building the sources

To build a solution and get assembly files, just run the following command. All build artifacts, including *.pdb files will be placed into the build folder. Before proposing a pull request, please use this command to ensure everything is ok. Btw, you can execute this command from Package Manager Console window.


To build NuGet packages as well as an archive file, use the pack command as shown below. You can find the result files in the build folder.

build pack

To see the full list of avalable commands, pass the -docs switch:

build -docs

Hangfire uses psake build automation tool. All psake tasks and functions defined in psake-build.ps1 (for this project) and psake-common.ps1 (for other Hangfire projects) files. Thanks to the psake project, they are very simple to use and modify!


Copyright © 2013-2014 Sergey Odinokov.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see


By submitting a Pull Request, you disavow any rights or claims to any changes submitted to the Hangfire project and assign the copyright of those changes to Sergey Odinokov.

If you cannot or do not want to reassign those rights (your employment contract for your employer may not allow this), you should not submit a PR. Open an issue and someone else can do the work.

This is a legal way of saying "If you submit a PR to us, that code becomes ours". 99.9% of the time that's what you intend anyways; we hope it doesn't scare you away from contributing.