本文介绍了快速应用程序将500丢到天蓝色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已采纳了此建议
尝试过server.js,app.js,目录结构等的所有可能组合.
以下代码可在本地完美运行...
The following code runs perfectly locally...
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); });但是当我将其部署到天蓝色时,会出现500错误.这是我的发现...
But when i deploy it to azure I get a 500 error. Here is my findings...
正在从本地git存储库中部署代码.
The code is being deployed from a local git repo.
推荐答案Azure Web Apps(网站)仅在端口80和443上侦听.您无法在端口8080上监听.
Azure Web Apps (web sites) listen on ports 80 and 443 only. You can not listen on port 8080.
您需要在端口process.env.PORT上监听.通过将端口代码调整为类似以下内容,您可以轻松地在本地和Azure中运行:
You'll need to listen on port process.env.PORT. And you can easily run both locally and in Azure by tweaking your port code to something like:
var port = process.env.PORT || 8080;
更多推荐
快速应用程序将500丢到天蓝色
发布评论