Azure: "You do not have permission to view this directory or page

31,945

Solution 1

I had the same issue,

you need web.config, package.json, server.js at the root

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:

 ...
  "scripts": {
    "start": "node server"
  },
...

and in your server.js make sure that you set the server port number to

process.env.PORT || 1337;

Solution 2

Edit: Try creating "Node JS Empty Web App" from the gallery at https://portal.azure.com and compare the web.config and the site with what you have. It's possible that you're missing some config settings.

enter image description here

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.

enter image description here

Solution 3

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.

enter image description here

enter image description here

Then, doing the set up deployment from source control at the quick glance of the web app dashboard page to deploy your web app.

enter image description here

enter image description here

Now, browse the web app http://<app-name>.azurewebsites.net that works fine.

Solution 4

You're probably missing the web.config file which is required if iisnode is used to run node processes behind iis or iis express.

https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config

Solution 5

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.

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.

enter image description here

Share:
31,945
serlingpa
Author by

serlingpa

Updated on July 28, 2022

Comments

  • serlingpa
    serlingpa over 1 year

    I have created a node.js application in Visual Studio 2015 using the Azure SDK 2.7 and the Node.js Tools.

    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.

    However, the page I reach (http://ftct.azurewebsites.net/) complains: You do not have permission to view this directory or page.

    I have specified a default file (kinda) in my node.js by using: 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.

    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.

    Any ideas?

  • theadriangreen
    theadriangreen over 8 years
    Compare your app with the gallery app, as I've explained above in my edit.
  • serlingpa
    serlingpa over 8 years
    I can;t find a node.js starter app in Azure! I did a search for "node" in the "New" section.
  • Peter Pan
    Peter Pan over 8 years
    @serlingpa Search "Node" at ms.portal.azure.com/#blade/Microsoft_Azure_Marketplace/… and you will find it.