Framework
Framework copied to clipboard
RequestCanceledMiddleware cannot work when url use 0.0.0.0
Describe the bug
When I Set asp.net core's applicationUrl to 'http://0.0.0.0:8080', the RequestCanceledMiddleware not work. But it is working well in 'http://127.0.0.1:8080' or 'http://localhost:8080'

Steps to reproduce
"profiles": {
"LTM.Module.CCM.TiehejiService01": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "weatherforecast",
"applicationUrl": "http://0.0.0.0:5074",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
app.UseHttpException();
app.UseRequestCanceled();
Expected behaviour
none
The middleware (code below) doesn't do anything with the host part of the URL. It only looks for OperationCanceledException and HttpContext.RequestAborted.IsCancellationRequested.
https://github.com/Dotnet-Boxed/Framework/blob/main/Source/Boxed.AspNetCore/Middleware/RequestCanceledMiddleware.cs
The middleware (code below) doesn't do anything with the host part of the URL. It only looks for
OperationCanceledExceptionandHttpContext.RequestAborted.IsCancellationRequested.https://github.com/Dotnet-Boxed/Framework/blob/main/Source/Boxed.AspNetCore/Middleware/RequestCanceledMiddleware.cs
Thanks.By the way,do you know why token.ThrowIfCancellationRequested(); can not throw exception when i changed the url to "http://0.0.0.0:5074" and cancel the request in edge?
Sorry, I'm not sure. What error do you get? That might be a question to ask in the ASP.NET repo.