为什么在Visual Studio for Azure中的node.js服务器的创build方式不同?
我在Azure项目中遇到了一个奇怪的问题,这似乎与服务器的创build方式有关。 该项目是使用Visual Studio 2013 Ultimate中的Basic Azure Node.js Express 4 Application
模板创build的。 经过一番斗争,该项目在本地运行良好,直到我点击浏览器的刷新button,永远不会回来。
该项目最初是在WebStorm创build的,我没有这个问题。 据我所知,他们之间的差异是非常小的:在WebStorm,这是用来:
var server = http.createServer(app); server.listen(process.env.PORT, process.env.IP);
但在Visual Studio中,这是使用(从www文件中的模板创build的):
app.set('port', process.env.PORT || 3000); var server = app.listen(app.get('port'), function() { console.log('express server listening on port ' + server.address().port); });
当我用WebStorm版本replace这个,一切似乎再次正常工作。 有人可以解释为什么吗?
顺便说一下,在我的应用程序中,我不使用节点视图。 相反,我正在使用:
app.set("view options", { layout: false }); app.all('*', function (req, res, next) { res.sendFile(__dirname + "/public/index.html"); // Just send the index.html for other files to support HTML5Mode });
这与这个问题有关吗?
- Nodejs上传base64图像到azure blob存储结果为“ResourceNotFound”错误
- 如何在azure网站子目录中运行node.js应用程序
- 使用Azure无服务器函数req.body返回HTML
- Azure / Node.js无例外:错误:找不到模块'ms'
- 我可以托pipeMS Bot框架Node.js实例本地
- Microsoft Azure函数和节点 – 我是Mac用户。 如何在Azure Portal中上传/安装Node软件包?
- AZURE Mobile Service在表插入脚本中转发POST请求
- 在Azure上通过Docker-compose部署nodeJS aps
- 如何在Azure上现有的node.js应用程序中安装Ghost?