node.js Azure:“您无权查看此目录或页面
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33835172/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Azure: "You do not have permission to view this directory or page
提问by serlingpa
I have created a node.js application in Visual Studio 2015 using the Azure SDK 2.7 and the Node.js Tools.
我使用 Azure SDK 2.7 和 Node.js 工具在 Visual Studio 2015 中创建了一个 node.js 应用程序。
I have successfully set up CI with BitBucket in my web app and I can see that changes to the repository do indeed trigger a build and deploy.
我已经在我的 Web 应用程序中使用 BitBucket 成功设置了 CI,我可以看到对存储库的更改确实触发了构建和部署。
However, the page I reach (http://ftct.azurewebsites.net/) complains: You do not have permission to view this directory or page.
但是,我访问的页面 ( http://ftct.azurewebsites.net/) 抱怨:您无权查看此目录或页面。
I have specified a default file (kinda) in my node.js by using: app.get('/', routes.index);
我在 node.js 中指定了一个默认文件(有点): app.get('/', routes.index);
So trying to navigate directly to this file, http://ftct.azurewebsites.net/signin.html, yields a different error: The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
因此,尝试直接导航到此文件http://ftct.azurewebsites.net/signin.html 会产生不同的错误:您要查找的资源已被删除、名称已更改或暂时不可用。
I configured the app to run on port 1337 in Visual Studio, but using this port doesn't overcome the problem. Trying to navigate to a ported address yields a timeout.
我将应用程序配置为在 Visual Studio 中的端口 1337 上运行,但使用此端口并不能解决问题。尝试导航到移植地址会导致超时。
Any ideas?
有任何想法吗?
回答by nimatra
I had the same issue,
我遇到过同样的问题,
you need web.config, package.json, server.js at the root
你需要 web.config, package.json, server.js 在根
web.config:
网络配置:
<configuration>
<system.webServer>
<handlers>
<!-- indicates that the app.js file is a node.js application to be handled by the iisnode module -->
<add name="iisnode" path="server.js" verb="*" modules="iisnode" />
</handlers>
</system.webServer>
</configuration>
in package.json you need to have:
在 package.json 你需要有:
...
"scripts": {
"start": "node server"
},
...
and in your server.js make sure that you set the server port number to
并在您的 server.js 中确保将服务器端口号设置为
process.env.PORT || 1337;
process.env.PORT || 第1337章
回答by theadriangreen
Edit: Try creating "Node JS Empty Web App" from the gallery at https://portal.azure.comand compare the web.config and the site with what you have. It's possible that you're missing some config settings.
编辑:尝试从https://portal.azure.com的库中创建“Node JS Empty Web App” ,并将 web.config 和站点与您拥有的进行比较。您可能缺少一些配置设置。
Previous answer: first off, only ports 80 and 443 are available in Azure Web Apps (the new name of Azure Websites). So port 1337 will not work. Reconfigure your app to run on port 80 or 443. Regarding the permission issue, do you have App Service Authentication enabled? Make sure that is disabled, by editing the Web App's application settings as below.
上一个答案:首先,Azure Web Apps(Azure 网站的新名称)中只有端口 80 和 443 可用。所以端口 1337 将不起作用。重新配置您的应用以在端口 80 或 443 上运行。关于权限问题,您是否启用了应用服务身份验证?通过如下编辑 Web 应用程序的应用程序设置,确保已禁用。
回答by Peter Pan
You can try to create a instance of "Node JS Empty Web App" from the Gallery at the old portal http://manage.windowsazure.com, see below.
您可以尝试从旧门户http://manage.windowsazure.com的库中创建“Node JS Empty Web App”实例,请参见下文。
Then, doing the set up deployment from source controlat the quick glanceof the web app dashboard page to deploy your web app.
然后,做set up deployment from source control在quick glanceWeb应用程序仪表板页面的部署你的Web应用程序。
Now, browse the web app http://<app-name>.azurewebsites.netthat works fine.
现在,浏览http://<app-name>.azurewebsites.net运行良好的网络应用程序。
回答by gchao
You're probably missing the web.config file which is required if iisnode is used to run node processes behind iis or iis express.
如果 iisnode 用于在 iis 或 iis express 后面运行节点进程,则您可能缺少 web.config 文件。
https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
回答by Leon
In my case, I got this error when using ZipDeploy: please be sure to compress files within the root folder, so that the Node.js files could be listed on Kudu at the a base level, instead of one folder more. Thanks to mike-urnun-msft.
在我的例子中,我在使用 ZipDeploy 时遇到了这个错误:请确保压缩根文件夹中的文件,以便 Node.js 文件可以在 Kudu 的基础级别上列出,而不是多一个文件夹。感谢mike-urnun-msft。
回答by Aman Mohammed
Also when you deploy the zip file via the azurewebsites.net/ZipDeployUI, make sure that you see the files being unzipped on the /wwwroot level.
此外,当您通过 azurewebsites.net/ZipDeployUI 部署 zip 文件时,请确保您看到正在 /wwwroot 级别解压缩的文件。
If the files show up under /wwwroot/your-app-folder/ you may get this permission issue. I took a long time to figure this out! Hope it helps.
如果文件显示在 /wwwroot/your-app-folder/ 下,您可能会遇到此权限问题。我花了很长时间才弄明白这个!希望能帮助到你。


