Cancellation Token in Requests
A token that is cancelled when the client disconnects.
What is Cancellation Token in Requests?
Add a CancellationToken parameter to a handler and ASP.NET Core cancels it if the client disconnects. Pass it to database and HTTP calls so abandoned requests stop working.
app.MapGet("/reports/{id:int}", async (int id, IReportService reports, CancellationToken ct) =>
await reports.BuildAsync(id, ct));
Level: Freelancer · More ASP.NET Core terms at this level
Updated