6

I'm trying to deploy a very simple express.js app on Azure webapp.

The deployment log shows the that the deployment passes correctly but the app doesn't start. Checking the kudu process explorer shows that indeed the node.js process is not running

enter image description here

On the other hand I don't see any application logs nor any indication that the app even started.

Is there a way to see what happened when the nodeiis tried to start the app?

Guy Korland
  • 9,139
  • 14
  • 59
  • 106
  • You can move your code to azure by FTP and start your webapp on azure directly. You don't have to check it from kudu explorer. – Alex Chen-WX May 09 '16 at 07:04
  • 1
    I know I don't kudu is not the issue here, it's just the tool to verify the deployment – Guy Korland May 09 '16 at 07:43
  • Thanks for helping me realise my problem. My nodejs was running but i getting no response. I forgot i had to use `port = process.env.PORT` :). – HankCa Jan 08 '19 at 05:44

5 Answers5

4

Azure WebApp for node.js is running via iisnode as a native IIS module that allows hosting in IIS on Windows. Please see the document https://blogs.msdn.microsoft.com/silverlining/2012/06/14/windows-azure-websites-node-js/ to know its features.

For debugging the webapp for node.js, I suggest you can refer to the document to know how to do it.

If you are using Visual Studio as the IDE for node.js, I recommend installing NTVS in VS for debugging and deploying the node.js. Please see the documents below to know how to get started.

  1. Installation for NTVS
  2. Install Node.js and get started with NTVS

And there is an other tool called node-inspector for inspecting the node.js app on Azure. As reference, you can refer to the doc http://www.ranjithr.com/?p=98.

Meanwhile, please check the web.config file in your node webapp via Kudo Console, you can compare your codes with the sample generated by the template for Express from Gallery on Azure portal.

Hope it help. Any concern, please feel free to let me know.


The process explorer shows the processes of my webapp for node.js. enter image description here

Peter Pan
  • 23,476
  • 4
  • 25
  • 43
  • 1
    Thanks for the detailed answer, but that is not the case here, I can't debug/check the node.js app since the iisnode never starts it (See the image above). How do I find out why the node process never started? – Guy Korland May 09 '16 at 10:45
  • @GuyKorland Please the image updated. The iisnode is a native IIS module that started up with IIS, so you can't see the process called iisnode. Please inspect the `web.config` & `app.js` file and be sure the configuration & the listen port `process.env.port` correct. – Peter Pan May 10 '16 at 02:15
1

You need to enable logging before you can get logs that would (hopefully) give you more details about the error. You can read more about it here.

David Ebbo
  • 42,443
  • 8
  • 103
  • 117
1

post my investigation step in here.
1. edit D:\home\site\wwwroot\iisnode.yml, from https://xxx.scm.azurewebsites.net/DebugConsole add below line

devErrorsEnabled: true  
  1. restart app service from Azure portal
  2. access your service, you will see something like this:

HRESULT: 0x2
HTTP status: 500
HTTP subStatus: 1002
HTTP reason: Internal Server Error

  1. go to https://learn.microsoft.com/en-us/azure/app-service/app-service-web-nodejs-best-practices-and-troubleshoot-guide#iisnode-http-status-and-substatus to find the meanings for substatus.

for more debugging skill, you can see: https://prmadi.com/debug-nodejs-app-in-azure-app-services-windows-2/

Redman
  • 642
  • 1
  • 5
  • 16
1

For the Azure Framework to run node, there must be a web.config file in the root folder configuring IIS to run the node process.

If you deploy via git, you don't have to worry about creating a web.config file. The Azure framework will perform a post deployment build action, which will

  • recognize your code as a node application and create a web.config file for you.
  • Run npm install to ensure that the required packages are present.

By default, the post deployment build action will NOT run for .zip deployments. You can solve this via one of the following two options:

  • Override the default setting so the build action does run OR
  • Include the web.config file and the node_modules folder in the zip file.

To override the default behavior and enable the build actions for zip deployments, simply add the application setting SCM_DO_BUILD_DURING_DEPLOYMENT, set to true

If you want to enable node using your own web.config file, see this answer for a sample web.config file. Also, see this blog: https://blogs.msdn.microsoft.com/silverlining/2012/06/14/windows-azure-websites-node-js/ for more detail.

Andrew Shepherd
  • 44,254
  • 30
  • 139
  • 205
0

You don't have to check/manage your webapp from kudu explorer.

You can reference article https://azure.microsoft.com/en-us/documentation/articles/app-service-web-nodejs-get-started/ to put your local node.js to azure by git.

And you can also move your code to azure by FTP which is showed in webapp dashboard page.

After that start your node.js web app on azure then you will be able to visit it.

If you want to see runtime log of your code, you can go to "yourwebapp ==> CONFIGURE ==> Application Diagnostics" in azure portal webapp to config your log.

Alex Chen-WX
  • 521
  • 2
  • 5