Create a directory for the project, let's call it ACCIOEmail. NET Core implements the IHostedService Interface. This code is interesting but doesn’t seem to be current (or even current as of ASP. One important thing to be aware of is that the BackgroundService has a different lifetime than the host. NETUsing Back Ground Worker I would to implement background service using built-in class of ASP. Seems good, I want to use that! The IHostedService interface provides a convenient way to start background tasks in an ASP. Using BackgroundService class we can only have one method that needs to be implemented which is ExecuteAsync(CancellationToken cancellationtoken). cd CreateAndInstallWorkerService\ dotnet new sln. 1 using Background tasks with hosted services.
I saw that there was an IHostedService, but ASP. Hosting, which includes the IHostService, BackgroundService, and so on. Backgroundservice net core Then the Task Parallel Library came along with the async & await keywords making it easier to run tasks in the background.