azure web app service - Intermittent 502s & zip is not exploding under wwwroot - Stack Overflow

admin2025-04-18  2

I'm encountering 502s intermittently when I execute the az web deploy command using Azure CLI in my local machine. The main concern is that a zip file, which is deployed to /home/site/wwwroot, isn't exploding properly. However, after multiple attempts it works and explodes the zip content properly. But I wonder why is this so inconsistent.

I tried to execute the same az command by adding parameters --timeout & --debug, but I have not clue why the error is happening intermittently, and the zip file not exploding properly under wwwroot in Windows App Service.

I'm encountering 502s intermittently when I execute the az web deploy command using Azure CLI in my local machine. The main concern is that a zip file, which is deployed to /home/site/wwwroot, isn't exploding properly. However, after multiple attempts it works and explodes the zip content properly. But I wonder why is this so inconsistent.

I tried to execute the same az command by adding parameters --timeout & --debug, but I have not clue why the error is happening intermittently, and the zip file not exploding properly under wwwroot in Windows App Service.

Share edited Feb 5 at 3:25 ZCGCoder 5342 gold badges10 silver badges30 bronze badges asked Jan 30 at 15:18 Rutwik KonduruRutwik Konduru 12 bronze badges 2
  • Please provide complete error and command. – Aslesha Kantamsetti Commented Jan 30 at 16:07
  • If possible, share kudu file image. – Aslesha Kantamsetti Commented Jan 31 at 5:28
Add a comment  | 

1 Answer 1

Reset to default 0

A 502 error occurs when the App Service is temporarily unavailable or not responding. This can be caused by Azure delays, network issues, or deployment conflicts.

When deploying a ZIP package, Azure automatically extracts it to /home/site/wwwroot. If it needs multiple attempts, the cause could be Incomplete or failed deployments or Files being locked during extraction.

Make Sure ZIP Deployment Mode is Correct check WEBSITE_RUN_FROM_PACKAGE is set to 0 or 1 by running below command.

az webapp config appsettings set --name <app-name> --resource-group <resource-group> --settings WEBSITE_RUN_FROM_PACKAGE=0

If it is set to 1 Azure won’t extract the ZIP, which may be causing the issue.

Stop the Azure Web app before deployment, this ensures there are no locked files that might prevent ZIP extraction. And start the app after deployment.

az webapp stop --name <app-name> --resource-group <resource-group>
az webapp deploy --resource-group <resource-group> --name <app-name> --src-path <zip-file-path>
az webapp start --name <app-name> --resource-group <resource-group>

Azure Output:

转载请注明原文地址:http://anycun.com/QandA/1744910871a89358.html