HttpContext.RequestAborted is not canceled when app is hosted under IIS with hostingModel = OutOfProcess #54936
Labels
area-networking
Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
feature-iis
Includes: IIS, ANCM
Is there an existing issue for this?
Describe the bug
Cancellation token
HttpContext.RequestAborted
is not triggered when App is hosted in IIS with such configuration:Method example:
Issue that seems related:
Expected Behavior
Cancellation token
HttpContext.RequestAborted
should trigger when a user cancels http request to IIS when app is hosted with AspNetCoreModuleV2 with hostingModel = OutOfProcessSteps To Reproduce
Case1 - cancelation doesn't work in IIS
dotnet publish -c Release
3.1 In my case I created the new website pointing to the publish output folder
C:\Projects\SlowWeatherInIIS\bin\Release\net8.0\publish
3.2 And I bind it to the 8081 port
4.1 Open http://localhost:8081/WeatherForecast and wait 10 seconds for output
4.2 Open http://localhost:8081/WeatherForecast again, but cancel request before it finishes (just close browser tab)
C:\Projects\SlowWeatherInIIS\bin\Release\net8.0\publish\logs
Actual: Has two "Got New Weather Request" logs.
Expected: Has two "Got New Weather Request" logs and has one "Request aborted" log.
The "Request aborted" log is missing.
Case2 - cancelation works as expected when hosted by kerstel only
dotnet publish -c Release
3.1 Navigate to publish folder (in my case
C:\Projects\SlowWeatherInIIS\bin\Release\net8.0\publish
)3.2 Start web service in cmd:
dotnet .\SlowWeatherInIIS.dll
3.3 Read the base url of app from console. (in my case http://localhost:5000 )
4.1 Open http://localhost:5000/WeatherForecast and wait 10 seconds for output
4.2 Open http://localhost:5000/WeatherForecast again but cancel request before it finishes (just close browser tab)
Actual: Has two "Got New Weather Request" logs and has one "Request aborted" log
Expected: Actual behavior matches expected.
Exceptions (if any)
No response
.NET Version
8.0.103
Anything else?
Reproduced this behavior locally with:
The text was updated successfully, but these errors were encountered: