Despite what is claimed in Microsoft blog post (ASP.NET Core Module section), I cannot configure IIS in-process hosting with AspNetCoreModuleV2 to set HttpContext.RequestAborted property IsCancellationRequested to true, when long-running XHR request from the web browser is aborted with abort() function.
XHR Request is cancelled on the browser side and it's clearly visible in network tab in Chrome, but CancellationToken in controller's action (nor HttpContext.RequestAborted) never get IsCancellationRequested property set to true.
WebSite *.csproj file contains properties:
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>inprocess</AspNetCoreHostingModel>
Web.config seems to be correct too:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="C:\Program Files\dotnet\dotnet.exe" arguments="exec "FullPathToMyWebsite.dll"" stdoutLogEnabled="false" hostingModel="InProcess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>
Compatibility version for services.AddMvc is set to 2.2:
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
Host is build with defaults, as adviced in documentation:
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
Am I missing something obvious here?