Is it possible to use Hangfire for Windows Applications?


#1

I use Hangfire on my Webservers already, so I am familar with the basics of Hangfire.

I am wondering If Hangfire will also work in a pure Windows Forms environment? I am talking about using Hangfire in a Windows Application to execute Background Jobs. At the moment, all my background jobs are performed on different threads in my windows application. But what happens if the application or pc crashes or is shutting down during processing? All my jobs are canceled and no one will see. But hangfire will retry those jobs after application restart and in future, I may create a Windows Service which executes jobs, triggered by other Windows applications.

So my Question is: Has anyone ever tried to use Hangfire this way? Or is this a stupid idea?


#2

@awpross, what background jobs do you want to run in your application? And what your application looks like?


#3

Using Hangfire for desktop applications seems counterintuitive to the structure of the operating system.


#4

most commonly this would be things like updating database entries, sending mails and other long running tasks which should be running under the user account who triggered the job.

At present, I use background tasks but if the app is closed before the tasks are completed, they won’t be triggered after app restart. Maybe I will include my own resumeable function, but If hangfire can do it, it would be faster to implememt.


#5

If your application is a server one that is placed near the database, why not? It is not tied to any application-level framework. But for client applications that are being installed on user machines it is definitely overkill.


#6

Long Time ago, I started this thread. And now, 3 years later, I have my first implementation of Hangfire inside my client Application.
As documentation of Hangfire changed over years, I was able to integrate it easylie. Now, I have a windows-service for hosting hangfire server, a client application, also hosting a local version of hangfire and even a Dashboard implementation using owin. Now my dreams have become true :wink:


#7

I hope you are still watching this thread. Please contact me, I need to do the same but everything is web based… I can pay you for your time and/or code.

-DC