I have a hosted background service in ASP.NET Core, and it coexists with a bunch of web controller APIs.
The background service is registered as a hosted service:
services.AddHostedService<SampleHostedService>();
My front end will poll the web controller APIs at a rate of every 1 second. However, I noticed if I put breakpoints inside the hosted service and step through it in Visual Studio. The web controller APIs no longer respond to the regular poll of front end in a timely manner.
Is there a way to separate the web controller APIs and hosted background service? So that when I debug and step through the background service, the web controller APIs will still respond in a timely manner?