Framework icon indicating copy to clipboard operation
Framework copied to clipboard

RequestCanceledMiddleware cannot work when url use 0.0.0.0

Open zxbeltm opened this issue 3 years ago • 3 comments

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'

real ip localhost 127IP

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

zxbeltm avatar Sep 01 '22 04:09 zxbeltm

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

RehanSaeed avatar Sep 01 '22 09:09 RehanSaeed

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

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?

zxbeltm avatar Sep 02 '22 02:09 zxbeltm

Sorry, I'm not sure. What error do you get? That might be a question to ask in the ASP.NET repo.

RehanSaeed avatar Sep 02 '22 10:09 RehanSaeed