I'm trying to deploy Django project to Azure App Service through Visual Studio. Once deployed and if I open the app URL an error is displayed ":( Application Error". Same error occurs if deployed from the GitHub Actions CI/CD through service principles.
Logs displaying this error "Container **** didn't respond to HTTP pings on port: 8000, failing site start"
Unable to find any solution for this.
Any help would be appreciated.
CodePudding user response:
By default, App Service assumes your custom container is listening on port 80
, however, your application was listening to requests on port 8000
, which led to the error.
If your container listens to a different port, set the WEBSITES_PORT
app setting in your App Service app.
That is an WEBSITES_PORT
as one of your app settings with the port your app is listening.
You can set it in Azure CLI:
az webapp config appsettings set --resource-group <group-name> --name <app-name> --settings WEBSITES_PORT=8000
(OR)
In Azure PowerShell:
Set-AzWebApp -ResourceGroupName <group-name> -Name <app-name> -AppSettings @{"WEBSITES_PORT"="8000"}
Note: App Service currently allows your container to expose only one port for HTTP requests.
Refer this link to Configure a custom container for Azure App Service.