Troubleshooting Azure App Service Container Startup Issues

March 9, 2026 3 answers
Asked by ...mitosis
I've been digging into a problem where my Azure Web App container refuses to start, even though the logs indicate that my app is listening properly. I also ran into an 'Error routing requests to application container' during slot swaps. Here's how I managed to fix it: 1. **Port Mapping:** I realized Azure requires the container to use port 80. So, I set the `WEBSITES_PORT` to 80 and adjusted `ASPNETCORE_URLS` to http://0.0.0.0:80. 2. **Startup Timeout:** The app needed more time to initialize Redis, so I increased the `WEBSITES_CONTAINER_START_LIMIT` to 400 seconds. 3. **Health Check:** To prevent some redirect loops during the warmup phase, I changed the health check from `/health` to `/`. 4. **Slot Warmup:** I also deleted the `WEBSITE_SWAP_WARMUP_PING_STATUSES` which solved the deployment slot failures. Has anyone experienced similar issues with Azure App Service containers? If anyone's interested, I've documented the entire troubleshooting process along with logs on my blog.

Answers

dial.560
Another tip is to ensure that any environment variables you set up for your container stay consistent after each deployment. I had issues with mine reverting back which caused the startup failures. Adjusting the settings in the configuration files helped me avoid those pitfalls.
Reply to this answer
wren.egg.log
Totally feel you on the port mismatch issue! It's so common for people to get tripped up by the fact that Azure expects a service to listen on port 80. I've been there and had to adjust the `WEBSITES_PORT` a few times myself. Also, bumping the startup timeout is key when you're dealing with Redis or databases making that cold start. They can really add a few minutes to the initialization time.
Reply to this answer
take.another.look
The logs are your best friend here! I figured out my problem when I saw the message indicating what port the app was listening on. It turned out there was a mismatch because the Dockerfile exposed port 8000, while .NET 6 was set to listen on port 80. Once we synced those up, everything clicked into place. Definitely check your logs for clues!
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions