We typically must execute background duties and scheduled jobs in our functions. To implement background duties in ASP.Net Core, you’ll be able to benefit from Azure WebJobs or any of a lot of third-party process schedulers like Quartz or Hangfire.
In ASP.Net Core, you’ll be able to implement background duties as hosted companies as nicely. A hosted service is a category that implements the IHostedService interface and consists of the required code for operating duties within the background. This article presents a dialogue of how we are able to construct hosted companies in ASP.Net Core.
At the time of this writing, Visual Studio 2019 is obtainable without spending a dime obtain. If you don’t have already got a duplicate of Visual Studio 2019 put in in your system, you’ll be able to obtain it from Microsoft’s Visual Studio downloads web page.
Create an ASP.Net Core mission in Visual Studio
First off, let’s create an ASP.Net Core mission in Visual Studio. To do this, observe the steps given under to create a brand new ASP.Net Core mission in Visual Studio 2019.
- Launch the Visual Studio IDE.
- Click on “Create new project.”
- In the “Create new project” window, choose “ASP.Net Core Web Application” from the checklist of the templates displayed.
- Click Next.
- In the “Configure your new project” window, specify the title and placement for the brand new mission.
- Click Create.
- In the “Create New ASP.Net Core Web Application” window, choose .Net Core because the runtime and ASP.Net Core 2.2 (or later) from the drop-down checklist on the prime.
- Select “Web Application” because the mission template.
- Ensure that the test containers “Enable Docker Support” and “Configure for HTTPS” are unchecked as we received’t be utilizing these options right here.
- Ensure that Authentication is ready as “No Authentication” as we received’t be utilizing authentication both.
- Click Create.