Mid-levelMid (3–6 yrs)C#.NETMicrosoftAmazon
CancellationToken usage
How should CancellationToken be used in ASP.NET Core APIs and background services?
Answers use simple, clear English.
Audio N/AQuick interview answer
Accept CancellationToken in controller/minimal API methods (HttpContext.RequestAborted) and pass it through to EF Core, HttpClient, and I/O. In hosted services, use StoppingToken. Never ignore cancellation in long loops or external calls.
Detailed answer
Accept CancellationToken in controller/minimal API methods (HttpContext.RequestAborted) and pass it through to EF Core, HttpClient, and I/O. In hosted services, use StoppingToken. Never ignore cancellation in long loops or external calls.
midseniortech-lead#async#aspnet