Hangfire | easy way to perform background job processing | Job Scheduling library

 by   HangfireIO C# Version: v1.8.2 License: Non-SPDX

kandi X-RAY | Hangfire Summary

kandi X-RAY | Hangfire Summary

Hangfire is a C# library typically used in Data Processing, Job Scheduling applications. Hangfire has no bugs, it has no vulnerabilities and it has medium support. However Hangfire has a Non-SPDX License. You can download it from GitHub.

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 and MSMQ.

            kandi-support Support

              Hangfire has a medium active ecosystem.
              It has 8301 star(s) with 1597 fork(s). There are 309 watchers for this library.
              There were 8 major release(s) in the last 12 months.
              There are 731 open issues and 1013 have been closed. On average issues are closed in 247 days. There are 51 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of Hangfire is v1.8.2

            kandi-Quality Quality

              Hangfire has 0 bugs and 0 code smells.

            kandi-Security Security

              Hangfire has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              Hangfire code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              Hangfire has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              Hangfire releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.
              Hangfire saves you 1137 person hours of effort in developing the same functionality from scratch.
              It has 2649 lines of code, 0 functions and 512 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Hangfire
            Get all kandi verified functions for this library.

            Hangfire Key Features

            No Key Features are available at this moment for Hangfire.

            Hangfire Examples and Code Snippets

            No Code Snippets are available at this moment for Hangfire.

            Community Discussions


            Job seems to run as Fire and Forget. Database activity continues for up to 10 minutes after success status
            Asked 2022-Apr-07 at 13:46

            I am debugging this hangfire service job call and can't figure out why hangfire is reporting a completed state while the stored procedures being called are continuing to run for up to ~10 minutes later. The parallel loop is running a stored procedure against up to 200 databases.

            The first image below shows the hangfire status (success in ~40 seconds), meaning the job function completed. The second image shows the Stored Procedures issued form the loop still running for many minutes later. As far as I know, hangfire will report success when the job function completes, report timeout after a max wait, or report error is an exception occurs. I don't see how this function could be exiting in 6 seconds if all tasks are awaited.

            Hangfire reports success in 40 seconds

            Long Running Query Detection shows queries from the job still running and falling in and out of blocking state many minutes later. The commands starting with --===================== represent the SP running against many different databases.

            Code I have started debugging ->



            Answered 2022-Apr-07 at 13:46

            My thoughts are that Parallel.ForEach does not await for the async lambda so PerformServiceWork ends before each lambda is still running.

            Try to use instead Task.WhenAll and await on it.

            As I recall Parallel.ForEach is more related to Threading while Tasks are an abstraction over Threads.

            Source https://stackoverflow.com/questions/71783124


            Scoped service in Hangfire Job Filter
            Asked 2022-Apr-04 at 14:00

            After searching & reading possibly every discussion related to the topic in question, there seemed not to be a clear (or even unclear) solution to this.

            I have a job filter that I want to apply to every job. What I want to do is: when the job fails (goes to FailedState, which happens when the max retry attemps exceed OR it is thrown in that state manually), I want to log a custom, user-friendly exception message to the database (my custom table).



            Answered 2022-Apr-04 at 14:00

            Inject a scoped service provider factory and then create the scoped service provider as needed

            Source https://stackoverflow.com/questions/71738163


            Configure Hangfire dashboard in a worker service in .Net 5?
            Asked 2022-Mar-16 at 11:32

            I am using Hangfire to schedule jobs in my worker service and want to use the hangfire dashboard. But it seems that there is no way to configure this. All the documentation uses the Startup class but I don't have any startup in my worker service. Also, the OWIN NuGet package is not supported in .Net 5. Here is what I've tried,



            Answered 2022-Mar-16 at 11:32

            Use the following Program.cs to configure Hangfire dashboard and your worker service:

            Source https://stackoverflow.com/questions/71492137


            Mass Transit: Using AWS SQS and Job Consumers
            Asked 2022-Mar-09 at 02:22

            Currently we're using Hangfire for scheduling and running long lived tasks. We need these tasks to be able to be retried in the event of an ungraceful shutdown, which Hangfire handles for us.

            We're looking to try and move to a producer/consumer model and I've built a basic prototype with Masstransit and AWS SQS, but I have some concerns about how to handle the event of a task being processed during an ungraceful shutdown.

            I understand that eventually the SQS visibility timeout will expire and the queued item will be picked up for processing again, but setting that timeout isn't trivial as the length of tasks can be quite varied and I'd prefer if the task could immediately resume/retry processing when the application starts up again.

            I got reading about Job Consumers and they seemed to be better fitted to this type of scenario, but all the examples I've seen are using RabbitMQ. Wondering if it's possible/appropriate to do this using SQS, or if there's a better approach?

            Thank you for taking the time to read this question :)



            Answered 2022-Mar-09 at 02:22

            MassTransit will extend the visibility timeout as long as the consumer is still running.

            I believe SQS has an upper-limit of something like 12 hours, but you should look it up and find out.

            Job Consumers have significantly greater requirements (sagas, temporary queues, etc.) and SQS is really annoying about not having auto-delete/expiring queues, so I'd stick to a regular consumer if you can swing it.

            Source https://stackoverflow.com/questions/71403386


            Running recurring job inside Startup
            Asked 2022-Mar-03 at 10:01

            If I have a recurring job that will be run daily inside the .net core application. For that purpose, I'm thinking to use the Hangfire library.

            My question is: will placing this code for executing this daily job here in the Configure method be the most logical place or you would suggest something else?



            Answered 2022-Mar-03 at 02:18

            Asp.net core provide a IHostApplicationLifetime which provide the methods which could be triggered when the application host has fully started, when the application host has performed a graceful shutdown, when the application host is performing a graceful shutdown.

            I think you could put this method inside the IHostApplicationLifetime's ApplicationStarted method will be good.

            More details about how to use it, you could refer to this article.

            Source https://stackoverflow.com/questions/71330166


            Hangfire looking for ISet in mscorlib.dll
            Asked 2022-Feb-04 at 09:34

            I'm getting this runtime exception with Hangfire after upgrading to .NET6



            Answered 2022-Feb-04 at 09:34

            As said in the comments, you should look in your Hangfire database for a serialized parameter featuring a ISet. It is the deserialization of this parameter which causes the issue, as indicated by :

            Source https://stackoverflow.com/questions/70114466


            Hangfire activator not disposing
            Asked 2022-Feb-03 at 17:13

            I am having trouble with Hangfire not disposing the objects it instances within a WebApi on NET 5.

            This is my configuration in "ConfigureServices()" (pretty standard, btw):



            Answered 2022-Feb-03 at 17:13

            As said in the comments, you should use :

            Source https://stackoverflow.com/questions/70958728


            Calling asynchronous I/O method from sync code
            Asked 2022-Jan-12 at 13:18

            I have this piece of code (in synchronous method):



            Answered 2022-Jan-11 at 10:23

            If it's an asp.net core application (not just old school asp.net) there is no problem with task deadlock. SynchronizationContext (which can cause deadlock without ConfigureAwait(false)) is null in asp.net core. There isn’t a SynchronizationContext in ASP.NET Core.

            Also without Task.Run - CallApiAndUpdateSthAsync will be executed on your current thread until the first await inside. With Task.Run - entire CallApiAndUpdateSthAsync will be executed out of your main execution. You can fix it with adding Task.Yield in the beginning of CallApiAndUpdateSthAsync.

            Source https://stackoverflow.com/questions/70664035


            Can Hangfire schedule jobs do this?
            Asked 2022-Jan-10 at 11:08

            I am evaluating Hangfire for an upcoming ASP.net Core project that has several scheduled and reoccurring tasks that need to execute independently of users clicking on web pages. I know that HangFire can do this if the web application is started because a request has come in. I need to know whether or not HangFire can execute a scheduled task between being rebooted and the first web request coming in.

            Example: Web server is rebooted at 11pm, and no web requests will come in to cause the web server to spin up until 5am the next morning. A scheduled task needs to be performed at 1AM. Will Hangfire execute this task even though the web application hasn't been started by an incoming request?

            If it can, is there a certain setup I need to do to allow this?

            Details, if needed: We are going to be using Kestrel hosted in a windows service and sitting behind an NGINX reverse proxy. This setup could be modified if needed to make HangFire meet this requirement.



            Answered 2022-Jan-10 at 11:08

            When running under IIS it would be a real problem, see Making ASP.NET application always running

            But it should not be problem for ASP.NET CORE with kestrel, see

            It is not necessary for ASP.NET Core, because application is exposed by a console application that it already always on – there are no timeouts, no suspends and other optimization techniques yet. All you need to do is to use supervisor as written in the official docs for Linux, or use Windows Service with automatic start time, when running on Windows.

            Source https://stackoverflow.com/questions/70625319


            Hangfire recurring job to call method is Startup using existing services
            Asked 2022-Jan-08 at 23:33

            I'm trying to setup Hangfire to run a recurring job within Startup.cs with a standalone method. For this to work, I need to grab some ApplicationServices I have injected already. But the job execution fails with this error:



            Answered 2022-Jan-08 at 23:33

            Here is the implementation that I found best worked for me:

            1 Register the service I wanted to schedule in Startup.cs

            Source https://stackoverflow.com/questions/69187043

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install Hangfire

              | master | dev --- | --- | --- Windows | [![Windows Build Status](https://ci.appveyor.com/api/projects/status/70m632jkycqpnsp9/branch/master?svg=true)](https://ci.appveyor.com/project/odinserj/hangfire-525) | [![Windows Build Status](https://ci.appveyor.com/api/projects/status/70m632jkycqpnsp9/branch/dev?svg=true)](https://ci.appveyor.com/project/odinserj/hangfire-525) Linux / OS X | [![Travis CI Build Status](https://travis-ci.org/HangfireIO/Hangfire.svg?branch=master)](https://travis-ci.org/HangfireIO/Hangfire) | [![Linux and OS X Build Status](https://travis-ci.org/HangfireIO/Hangfire.svg?branch=dev)](https://travis-ci.org/HangfireIO/Hangfire).
            Hangfire is available as a NuGet package. You can install it using the NuGet Package Console window:. After installation, update your existing [OWIN Startup](http://www.asp.net/aspnet/overview/owin-and-katana/owin-startup-class-detection) 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](http://docs.hangfire.io/en/latest/quick-start.html) guide to learn about how to install Hangfire.


            Open-source projects develop more smoothly when discussions are public. If you have any questions, problems related to Hangfire usage or if you want to discuss new features, please visit the [discussion forum](http://discuss.hangfire.io). 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](https://github.com/HangfireIO/Hangfire/issues?state=open). Detailed reports with stack traces, actual and expected behaviours are welcome.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone HangfireIO/Hangfire

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Reuse Pre-built Kits with Hangfire

            Consider Popular Job Scheduling Libraries

            Try Top Libraries by HangfireIO


            by HangfireIOC#


            by HangfireIOJavaScript


            by HangfireIOC#


            by HangfireIOHTML