[英]Cannot deploy a react app to azure app services
I'm trying to deploy a basic react app to Azure app services, but I cannot get it to work.我正在尝试将一个基本的 React 应用程序部署到 Azure 应用程序服务,但我无法让它工作。
The app itself is the initial app created following npx create react app my-app command.该应用程序本身是根据npx create react app my-app命令创建的初始应用程序。 I want to get this one working first before trying to deploy my actual react app.
在尝试部署我的实际 React 应用程序之前,我想让它先工作。
The Azure App Service is a Linux setup, using node 16. I've added “pm2 serve /home/site/wwwroot --no-daemon” as the startup command. Azure 应用服务是一个 Linux 设置,使用节点 16。我添加了“pm2 serve /home/site/wwwroot --no-daemon”作为启动命令。 I've also added PORT 3000 and WEBSITE_PORT 3000 in app settings.
我还在应用程序设置中添加了 PORT 3000 和 WEBSITE_PORT 3000 。
Lastly I've added a web.config file to the react app itself.最后,我向 React 应用本身添加了一个 web.config 文件。
Nothing I do seems to work though as it is not loading at all.我所做的一切似乎都不起作用,因为它根本没有加载。 I just get 'application error' if I try to open the app.
如果我尝试打开应用程序,我只会收到“应用程序错误”。
The only two errors i can see in the logs are:我在日志中看到的唯一两个错误是:
“…didn't respond to HTTP pings on port: 3000” and “… did not start within expected time limit” “……没有响应 HTTP 端口上的 ping:3000”和“……没有在预期的时限内启动”
My deployment is set as continuous via git hub, though as this is building without an issue I think the problem must be something in the Azure App Service settings but I'm lost as to what.我的部署通过 git 集线器设置为连续部署,但由于这是在构建时没有问题,我认为问题一定出在 Azure 应用服务设置中,但我不知道是什么。
Does anyone have any ideas to fix this?有没有人有解决这个问题的想法?
It could be that there is no access to port 3000 in the app service.可能是应用服务没有访问3000端口。
It depends on how you have set it up what needs to be fixed.这取决于您如何设置需要修复的内容。 It could be the.network settings on the app service.
它可能是应用程序服务上的网络设置。 If your app service is on a .NET then it could be the settings on the .NET that need to be updated.
如果您的应用程序服务位于 .NET 上,则可能需要更新 .NET 上的设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.