Why my ASP.NET razor page app cannot access a specific endpoint?

Alex Corsega 0 Reputation points
2024-07-22T20:13:11.8566667+00:00

I have an issue with my ASP.NET app where it cannot access a specific endpoint. It throws a 502 error in Azure and a request timed out on my local machine. The endpoint I want to access is the products endpoint. I found that HttpContext.RequestAborted.IsCancellationRequested is set to true after passing through a certain middleware, which I can't identify since it is a built-in middleware and I cannot put a breakpoint on it. I noticed this because I have a custom middleware, and before calling the await _next(httpContext); method, IsCancellationRequested is set to false. However, after it is called, IsCancellationRequested is set to true, which I believe is the main reason for the error. Additionally, I discovered that I can access the products endpoint in incognito mode because IsCancellationRequested is always false whether before or after calling await _next(httpContext);, which is quite strange.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,394 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 61,491 Reputation points
    2024-07-23T18:49:48.0633333+00:00

    most likely the request is timing out. the timeout is what sets the cancellation token.

    0 comments No comments