9

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
  • 2,190
  • 1
  • 13
  • 13
serlingpa
  • 10,894
  • 22
  • 67
  • 122

8 Answers8

9

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;

nimatra
  • 584
  • 7
  • 19
3

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

theadriangreen
  • 2,190
  • 1
  • 13
  • 13
  • Compare your app with the gallery app, as I've explained above in my edit. – theadriangreen Nov 23 '15 at 20:15
  • I can;t find a node.js starter app in Azure! I did a search for "node" in the "New" section. – serlingpa Nov 23 '15 at 21:33
  • @serlingpa Search "Node" at https://ms.portal.azure.com/#blade/Microsoft_Azure_Marketplace/GalleryFeaturedMenuItemBlade/selectedMenuItemId/WebAndMobile_MP/searchQuery//launchingContext//resourceGroup//resourceGroupLocation//dontDiscardJourney//resetMenuId/ and you will find it. – Peter Pan Nov 24 '15 at 01:48
2

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.

Peter Pan
  • 22,121
  • 4
  • 21
  • 39
1

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

gchao
  • 300
  • 3
  • 7
1

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.

Leon
  • 637
  • 8
  • 18
1

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

Aman Mohammed
  • 2,778
  • 4
  • 22
  • 37
0

My situation is similar but slightly different. I was working on the Facebook Messenger Platform "Setting Up Your Webhook" documentation steps.

localhost was working just fine, but upon deployment, it would simply say what others have noted.

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

my final package.json looked like it, and it worked.

  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js"
  },

I think, the issue boils down to the way facebook provided the demo code. The demo code simply does not have everything needed to deploy specifically on azure.

I have put my final code here (it can be used as a starter i think for another person who is running into deployment issues).

Also, interestingly enough, others have suggested web.config, but I did not need it really.

https://github.com/Jay-study-nildana/FBMessengerWebHook

Jay
  • 2,089
  • 2
  • 23
  • 42
0

The problem is most likely the wrong folder was pushed up. For an ASP.NET server the root folder must have the index.html file.

Angular Specific

  1. Before deploying issue ng build --prod in your dev environment.
  2. This creates a 'dist' folder in the solution.
  3. Next open Visual Studio Code to the first folder in the 'dist' folder.

In this case the folder name was 'resume' which just so happened to be the Angular project name. Note that the index.html file is in this folder.

first folder in the dist folder, is same name as project

Note you know you are on the right track when pushing this up because this folder is small and it finishes quickly.

I use the Azure tools plugin for VSCode, it simply prompts me for the proper subscription (your Microsoft account) and from there just click the up arrow for the upload!

JWP
  • 6,318
  • 3
  • 45
  • 70