I am trying to cancel a long-running action on the server side when the client cancels or aborts the request. I am using ASP.Net Core 6.0 and the fetch API with Signal.
HttpContext.RequestAborted.IsCancellationRequested
is always false.
while (true)
{
CancellationToken cancellationToken = HttpContext.RequestAborted;
if (cancellationToken.IsCancellationRequested)
{
tokenSource2.Cancel();
}
}