I have an API with .net core 2.1 and use cancellation tokens in actions. When i run the project with iis and make a simple request in browser, after i cancel it, it doesn't work as expected and run all methods with cancellation token passed to them. But when i run the project using the kestrel server, cancelling the request causes the server to work as expected. why is that?
[HttpGet("get")]
public async Task<IActionResult> GetSome(CancellationToken ct)
{
_logger.LogInformation("The slow Request Start");
try
{
await Task.Delay(10_000, ct);
_logger.LogCritical("Successful");
}
catch (Exception)
{
_logger.LogInformation("Task Cancelled");
}
var message = "The request finished";
_logger.LogInformation(message);
return NoContent();
}