簡體   English   中英

節點應用程序部署到Azure App Service:錯誤:該服務不可用

[英]Node app deployed to Azure App Service : Error: The service is unavailable

我遵循了有關使用Azure App Service擴展從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教程獲得 )執行了相同的過程,並且得到了:

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.

我感覺到我在做一些明顯的錯誤,或者擴展正在修改代碼。 我從哪里開始?

謝謝

我嘗試將我的應用程序(我嘗試部署到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 () {

有趣的是,我嘗試過的第二個回購協議已經使用了這兩種技術,因此我對如何解決這個問題並不明智。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM