【问题标题】:Node app deployed to Azure App Service : Error: The service is unavailable部署到 Azure 应用服务的节点应用程序:错误:服务不可用
【发布时间】:2019-08-06 05:54:31
【问题描述】:

我关注tutorial 使用 Azure 应用服务扩展从 VSCode 部署一个简单的 Node 应用。

应用程序在本地运行良好。

当我部署时,我得到这个输出:

Creating resource group "appsvc_linux_centralus" in location "centralus"...
Successfully created resource group "appsvc_linux_centralus".
Ensuring App Service plan "appsvc_linux_centralus" exists...
Creating App Service plan "appsvc_linux_centralus"...
Successfully created App Service plan "appsvc_linux_centralus".
Creating new web app "XXX-node-users-api"...
Created new web app "XXX-node-users-api": https://XXX-node-users-api.azurewebsites.net
21:28:12 XXX-node-users-api: Creating zip package...
21:28:33 XXX-node-users-api: Starting deployment...
Error: The service is unavailable.

在门户中,Diagnose and solve problems 中没有列出任何内容。我怎么知道为什么服务不可用(当我点击链接时它会显示)?

更新: 我使用不同的 Node 应用程序(我从另一个 MS tutorial 获得)遵循相同的过程,我得到了这个:

Using existing resource group "appsvc_linux_centralus".
Ensuring App Service plan "appsvc_linux_centralus" exists...
Successfully found App Service plan "appsvc_linux_centralus".
Creating new web app "nodejs-docs-hello-world-20190805"...
Created new web app "nodejs-docs-hello-world-20190805": https://nodejs-docs-hello-world-20190805.azurewebsites.net
22:13:06 nodejs-docs-hello-world-20190805: Creating zip package...
22:13:07 nodejs-docs-hello-world-20190805: Starting deployment...
22:14:31 nodejs-docs-hello-world-20190805: Fetching changes.
22:14:31 nodejs-docs-hello-world-20190805: Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/59khfmlp.zip (0.00 MB) to /tmp/zipdeploy/extracted
22:14:31 nodejs-docs-hello-world-20190805: Central Directory corrupt.
Error: Deployment to "nodejs-docs-hello-world-20190805" failed. See output channel for more details.

我感觉我在做一些明显错误的事情,或者扩展程序正在破坏代码。我从哪里开始?

谢谢

【问题讨论】:

    标签: node.js azure visual-studio-code azure-web-app-service


    【解决方案1】:

    我尝试将我的应用程序(我尝试部署到 Azure 的第一个应用程序)部署到 Heroku,相比之下这很简单,而且日志很容易获取。

    这样做意味着我需要做出两个改变。然后我可以使用 VS Code 扩展部署到 Azure。

    1. package.json 中没有 npm start 脚本,所以我添加了一个。
    2. 端口被静态设置。至少对于 Heroku 来说,这是不允许的。已更改

    var server = app.listen(3000, function () {

    var server = app.listen(process.env.PORT || 3000, function () {

    有趣的是,我尝试的第二个 repo 已经使用了这两种技术,所以我不知道如何解决这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-07-07
      • 2023-03-27
      • 1970-01-01
      • 1970-01-01
      • 2020-04-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多