0

I have a Node.js script that I want to run in Azure on a Web app.

This script is not an express web site, rather it's a worker script which polls a database for work to perform, and when done it just polls and waits, e.g. there is not user interface for it.

I notice that after deploying it, even though it's setup with iisnode, it won't actually start until I fire up a browser and navigate to the Azure Web app host, even though it doesn't have a UI.

Only when I navigate to it does iisnode start logging and fire up my application. Then it happily polls the database and performs the required work.

Does anyone know how you can make a site just automatically start when deployed?

There seem to be autostart web.config settings available with IIS, but I don't know how to get iisnode or the Azure Web app to support it.

I could set up a Web job on the machine that just performs a GET from the site, but that seems a bit of overkill and messy.

David Thomas
  • 2,264
  • 2
  • 18
  • 20
  • You can get this node script run as an azure function app which is a serverless architecture approach. This can be scheduled and can be triggered based on certain events. I guess you are doing the processing in a loop. so you can schedule this app to start immediately after deployment. – Aravind Jul 26 '16 at 11:43

1 Answers1

1

You can leverage Function App to satisfy your requirement. Also, your original solution which build an Azure Web App without UI should be work.

However, please pay attention that Azure App Services will be unloaded after they have been idle. You can enable the Always on application setting to keep the app loaded all the time. Please refer to https://azure.microsoft.com/en-us/documentation/articles/web-sites-configure/#application-settings for more details.

enter image description here Any further concern, please feel free to let me know.

Gary Liu
  • 13,758
  • 1
  • 17
  • 32
  • Thanks for that. My understanding is that there isn't as much logging and debugging support for Function Apps as there is for a full running Web App. Is this still true? – David Thomas Jul 29 '16 at 02:09
  • function app is a kind of Azure App Services, what you can configure in Web apps also can set in Function Apps. Also, you can custom 3rd part nodejs log modules for troubleshooting. You can refer to the update image. – Gary Liu Jul 29 '16 at 04:04
  • Thanks very much Gary, I'll have a look at this. Great to see Function Apps getting more features in Azure. – David Thomas Jul 29 '16 at 05:47