如何在Azure上后台运行一个应用程序的Node.js [英] How to run a node.js app in background on Azure

查看:244
本文介绍了如何在Azure上后台运行一个应用程序的Node.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有这个简单的应用程序的NodeJS,并希望它作为一个 Web应用程序在后台运行,部署到Azure的:

Say I have this simple nodejs app and want to deploy it to Azure as a web app to run in background:

//server.js
function test() {
    // send some request to a url
}
setInterval(test, 10000);

所以我加入了 Procfile 做这在Heroku和像工作者的命令:节点server.js ,但什么是对湛蓝的平等的方法?

So I'd do this on Heroku by adding a Procfile and a command like worker: node server.js, but what's the equal method for azure?

推荐答案

在微软Azure应用服务后台任务被称为WebJobs。您可以执行下列任何一个WebJob的:

Background tasks in Microsoft Azure App Service are called WebJobs. You can execute any of the following as a WebJob:


  • 的.cmd,.bat和.exe文件(使用CMD窗口)

  • 的.ps1(使用PowerShell的)

  • .SH(使用bash)

  • 的.php(使用PHP)

  • 的.py(使用python)

  • .js文件(使用节点)

  • 的.jar(使用Java)

您可以阅读更多关于微软Azure官方文档中心WebJobs:
运行后台任务,WebJobs

You can read more about WebJobs on Microsoft Azure official documentation center: Run Background tasks with WebJobs

此外,斯科特 - 阿伦对的Node.js和WebJobs很好的教程:
天青WebJobs随着Node.js的

Also, Scott Allen has nice tutorial on node.js and WebJobs: Azure WebJobs With Node.js

这篇关于如何在Azure上后台运行一个应用程序的Node.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆