Express应用程序在azure色上投掷500个
下面的代码在本地运行完美…
var express = require('express'); var app = express(); app.get('/', function (req, res) { res.send("Hello World"); }); var port = 8080; app.listen(port, function () { console.log('Server started and is listening on port ' + port); });
但是,当我部署到azure,我得到一个500错误。 这是我的发现…
- 我已经接受了这个build议
- 已经尝试了所有可能的组合server.js,app.js,目录结构等
代码正在从本地的git仓库进行部署。
Azure Web Apps(网站)仅在端口80和443上侦听。 你不能听港口8080。
您需要监听端口process.env.PORT
。 而且您可以轻松地在本地和Azure中运行端口代码,如下所示:
var port = process.env.PORT || 8080;
- Microsoft Azure持续集成 – 使用Grunt“编译”步骤的NodeJs解决scheme
- Azure Cosmos DB:TypeError:无法读取未定义的属性'electionId'
- Azure Webjob System.IO.PathTooLongException
- Azure Web App WebJob不安装节点包
- 使用Node.js Passport的Azure AD身份validation返回“此API版本不支持”
- 使用nodejs将数据从Rfid rc522发送到azureiot集线器
- 我可以在Microsoft Azure的Node.JS中使用本地“fs”文件系统吗?
- Azure Blob存储哈希不匹配(完整性检查失败)
- 使用包含Node.js项目的TeamCity构buildCloud Service包