![]() ![]() I picked the simply because of my familiarity with it. I believe both of them can achieve the same result in this scheduling scenario. You can read their differences from this article in Microsoft Docs. ![]() Note: line 3 specifies that the type of the timer is, which is different from the. In this CronJobService, we use a timer to track the time and trigger the background task when the time hits the schedule. The Cronos is an open source project sponsored by HangfireIO, and you can read detailed documentation from its GitHub repository. ![]() The Cronos package is a lightweight but full-fledged library for parsing cron expressions and calculating next occurrences with time zones and daylight saving time in mind. In order to parse the cron expressions, we add a NuGet package Cronos to the Web API project. All ASP.NET Core web project templates and the Worker Service template have already included this NuGet package. The goal is to have a project that references the NuGet package, which includes the IHostService, BackgroundService, and so on. You can also follow the tutorial in Microsoft Docs, and create a Console project using the Worker Service template. The reason why we create a Web API project is to demonstrate the possibilities of hosting cron jobs in an ASP.NET Core web application. In this project, we will work on an ASP.NET Core Web API project.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |