Hi @kejiz23,
I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!
Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.
Issue :
After deploying a new ASP.NET
Core web app to Azure, the app was redirecting from https://mywebapp.azurewebsites.net
to https://mywebapp
, which doesn’t exist, causing 301 redirects and resulting in HTTP 500/503 errors. Remote debugging wasn’t working, and logs including stdout
and trace logs were empty. Root-level (/
) URLs were affected, though direct navigation to specific routes like /Account/SignIn
or /Home
worked fine.
Solution :
To resolve the issue, try adding the following middleware early in your Startup.Configure()
method to help debug request behavior:
app.Use(async (context, next) => {
Console.WriteLine($"Request URL: {context.Request.GetDisplayUrl()}");
await next();
});
In this case, although no actual code change was ultimately responsible, deploying this logging change seemed to coincide with the issue resolving itself. It's possible that an Azure App Service environment refresh, cold start or configuration cache reset played a role.
After the redeployment, the root URL (/
) started working correctly without redirecting.
Please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.