Hangfire is a great library to schedule and execute asynchronous work in a web application. One of the things I like about this library is that you can start with a simple background process inside the Application Pool and when your jobs get larger(and take more time) you can move them to a separate process.
Here are the steps to move your Hangfire jobs outside your web application:
- Step 1 – Change the Hangfire configuration inside your web app to disable the Hangfire server functionality(note that the job information is stored inside a database):
- Step 2 –Schedule your jobs(like you did before):
- Step 3 – Inside another project, a console application in this case, you can host the Hangfire server: