为什么在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 });
这与这个问题有关吗?
- 从自定义node.js API中检索Azure Blob
- 将私有文件存储在Windows Azure上托pipe的node.js应用程序中的最佳方法
- 发布到Azure时找不到模块gulp.js
- 使用node-gyp的node.js应用程序无法在Azure网站上部署
- 如何在azure-mobile-apps-js-client中使用substringof
- 在Azure网站上使用Node.js进行image processing
- Microsoft Bot Framework请求中的MissingProperty错误
- 如何在部署成功后通过VSTS在Azure应用服务上运行npm命令?
- Node.js客户端连接和Azure交易计费成本