VS2022 template "ASP.NET Core Worker Service template" missing

EuroEager2008 171 Reputation points

The article
mentions a template named "ASP.NET Core Worker Service template".

I assume this is ment to be a template accesible by VS2022, but I cannot find it.
What am I doing wrong?

A set of technologies in the .NET Framework for building web applications and XML web services.
4,389 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,874 questions
{count} votes

Accepted answer
  1. Jerry Fu - MSFT 571 Reputation points Microsoft Vendor

    Hi @EuroEager2008 ,

    I didn't find a template to run worker service in asp.net core app/API project officially. But there are some clues to do this. Although the article uses Ihost to build service project. You can still register the service class directly to asp.net core project which host by webapplicationbuilder like below.


    (Note that the 'worker' is copy from the default worker service template," TimedHostedService" is the code from https://learn.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?source=recommendations&view=aspnetcore-7.0&tabs=visual-studio#timed-background-tasks ).

    They will work the same as in a Ihostbuilder project.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful