ASP.NET 9 app trying to bind to localhost when running

Andy Gill 21 Reputation points
2025-06-12T20:45:25.55+00:00

I've got an app I haven't deployed to in a few months (https://devbackofficescheduler-staging.azurewebsites.net/) but I haven't made many changes if any. I've likely updated the framework and done so on the config of the web app, but I'm getting 502 and 503 errors. It runs fine locally but not when I publish to azure, to either of two slots. I'm not getting anything useful in the app log live stream:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"><HTML><HEAD><TITLE>Service Unavailable</TITLE><META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD><BODY><h2>Service Unavailable</h2><hr><p>HTTP Error 503. The service is unavailable.</p></BODY></HTML>

and when I run dotnet backofficescheduler.web.dll in the console I either get what seems to be a timeout error (failed to execute command after about a minute) or I get this exception: System.IO.IOException: Failed to bind to address http://127.0.0.1:5000: address already in use

I'm not sure if this looking for localhost port 5000 is a misconfiguration or just part of the usual azure process?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.