The simple implementation method of Hangfire in ASP. net core, hangfirecore
Hangfire is a tool to execute background tasks, see the official website for details: https://www.hangfire.io/
Create an asp.net core mvc Project
Introduce nuget package Hangfire. AspNetCore
The hangfire task requires database persistence. We modify ConfigureServices in the Startup class.
Then enable hangfire middleware in the Configure method
Now let's run the project. We can see that many tables are automatically generated in the database. These tables are used to persist tasks.
Open the following address to view the hangfire job control panel.
Add a periodic job to the Configure method and execute the output once every minute.
Start the application again
The output job already exists.
Modify the code again. If there are two tasks to send and receive messages, write an interface IMessage, and the Message interface is implemented.
Register in starup,
Then use
Start the program again
The two new jobs are available.
The above is just a simple use of hangfire in asp.net core.
The simple implementation method of this Hangfire in ASP. net core is all the content that I have shared with you. I hope to give you a reference and support for the help house.