I am developing a web application with a REST Api using C# with asp.net core 2.0
What I want to achieve is when the client send a request to an endpoint I will run a
Microsoft has documented the same at https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-2.1
It accomplishes using BackgroundTaskQueue, which gets work assigned from Controller and the work is performed by QueueHostedService which derives from BackgroundService.