我正在使用这个教程https://medium.com/geekculture/easiest-way-to-host-your-react-app-azure-vs-code-8046f9f7fb0b将我新创建的React应用部署到Azure应用服务。然而,我一直得到下面的错误。知道为什么吗?
我尝试了各种各样的故障排除从互联网上,如
SetWEBSITES_PORT
andPORT
Setting to80
但到目前为止还没有运气。
2021-10-05T16:31:37.859Z INFO - Initiating warmup request to container managementlnxdev_0_9e7876cc for site managementlnxdev
2021-10-05T16:31:53.746Z INFO - Waiting for response to warmup request for container managementlnxdev_0_9e7876cc. Elapsed time = 15.8869901 sec
2021-10-05T16:32:08.969Z ERROR - Container managementlnxdev_0_9e7876cc for site managementsitedev has exited, failing site start
2021-10-05T16:32:08.972Z ERROR - Container managementlnxdev_0_9e7876cc didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
2021-10-05T16:32:08.989Z INFO - Stopping site managementlnxdev because it failed during startup.
我在为容器部署一个ReactJS应用到Azure Web应用时遇到了这个问题
当我将应用程序部署到Azure时,我会得到下面的错误:
2021-06-10T10:29:05.571Z INFO - Initiating warmup request to container mediumblogreact_5app for site devopsapptest
2021-06-10T10:29:07.733Z ERROR - Container mediumblogreact_5app for site devopsapptest has exited, failing site start
2021-06-10T10:29:07.737Z ERROR - Container mediumblogreact_5app didn't respond to HTTP pings on port: 80, failing site start. See container logs for debugging.
改变端口3000,而不是80,这是假定您的自定义应用程序服务容器默认监听。
下面的CLI/PowerShell命令将有助于更改端口值:
在Azure CLI中:
az webapp config appsettings set --resource-group <rg-group-name> --name <web-app-name> --settings WEBSITES_PORT=8000
在Azure PowerShell中:
Set-AzWebApp -ResourceGroupName <rg-group-name> -Name <web-app-name> -AppSettings @{"WEBSITES_PORT"="8000"}
注意:你的容器现在只能通过App Service为HTTP请求公开一个端口。
你可能还想在你的项目的Docker文件中包含EXPOSE your-port命令。
:为Azure应用服务配置自定义容器