简体   繁体   English

如何将Node.js VS项目部署到Azure中?

[英]How to deploy Node.js VS project into Azure?

I just want to try some new stuff using Node.js in Visual Studio 2013. I created a new project using " Basic Azure Node.js Express 4 Application " template. 我只想在Visual Studio 2013中使用Node.js尝试一些新东西。我使用“ Basic Azure Node.js Express 4 Application ”模板创建了一个新项目。 Without adding any my own code, it runs fine locally. 无需添加我自己的代码,它可以在本地正常运行。 Then, I tried to deploy it into Azure as a website. 然后,我尝试将其作为网站部署到Azure中。

When I use Publish menu from VS, I got stuck at sign in. It keeps complaining " no microsoft azure subscriptions were added. sign in with an account that has subscriptions ". 当我从VS使用“发布”菜单时,我陷入了登录困境。它一直抱怨“ 未添加任何Microsoft Azure订阅。使用具有订阅的帐户登录 ”。 But I have the correct account, and based on this Q/A , I do see my subscription shown as "Visual Studio Premium with MSDN" and Role as "Service administrator" from the Setting tab in the Windows Azure Management Portal when I log in from website. 但是我有正确的帐户,基于此Q / A ,我确实在登录时看到我的订阅显示为“带有MSDN的Visual Studio Premium”和角色为“服务管理员”,来自Windows Azure管理门户中的“设置”选项卡从网站。 What's problem? 什么问题?

Then, I tried to deploy it using LocalGit as shown in this tutorial . 然后,我尝试使用LocalGit部署它,如本教程所示。 After some struggle, it seems to have deployed. 经过一番努力,它似乎已经部署完毕。 However, when I try to open the url, I got the error " You do not have permission to view this directory or page. " For which I couldn't find answer either. 但是,当我尝试打开URL时,出现错误“ 您无权查看此目录或页面。 ”我也找不到答案。 So, I'm stuck again. 所以,我再次陷入困境。

Ensure server.js is in the root of the repository. 确保server.js位于存储库的根目录中。 Else Set default webpage for website on Microsoft Windows Azure 否则在Microsoft Windows Azure上设置网站的默认网页

This part of package.json is also critical: package.json这一部分也很关键:

  "main": "main.js",  // required script
  "scripts": {
    "start": "node main.js"  // npm start command
  },
  "engines": {
    "node": "0.12.3"  // must be on platform
  },

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM