Reputation: 465
I stopped the World Wide Web Publishing Service and changed the Startup Type to Disabled and ran as administrator to start the website but received the EACCES.
Is this a permissions error? I have read that running the website with sudo on linux / unix fixes this, but what about on windows?
EDIT: I ended up using iisnode as I could not resolve the EACCES error on port 80. Here are the steps I used to get my node server running on iis through iisnode module:
*Install iisnode (wherever you want);
*Install 'URL Rewrite' plugin for iss;
*Create new site;
*Create web.config file with:
(Please find an example web.config file at the bottom of this post)
*Give SERVER/IIS_IUSRS write permissions to the directory / virtual directory found in iis of the site;
*Create local binding;
*Create external binding with *:80 as port;
*Make sure that node's http listener is set to listen on process.env.PORT as iisnode will set this environment variable to 80 for http requests;
Example web.config file in the root folder and assuming that the node server (in this case it will be called app.js) is also just in the root folder too.
<configuration>
<system.webServer>
<!--Tells iis that app.js is to be handled by iisnode module-->
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<!--Url rewrite rule that anything coming to any url of within site goes through app.js-->
<rewrite>
<rules>
<rule name="toNode">
<match url="/*"/>
<action type="Rewrite" url="app.js"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
EDIT: For the most part, I followed this tutorial: https://www.youtube.com/watch?v=JUYCDnqR8p0
Upvotes: 5
Views: 7425
Reputation: 31219
You can also generate a Node.js Azure Webapp from Azure CLI.
Install Azure CLI with NPM:
c:\> npm install azure-cli -g
Login to your azure account:
c:\> azure login
Change mode to asm
c:\> azure config mode asm
From your local git repository, create an azure webapp (named yoursite):
c:\git\yoursite> azure site create --git yoursite
This will generate add all the necessary settings in the issnode.yml
file.
Commit with git:
c:\git\yoursite> git add . && git commit -m "initial commit"
Push the modifications to the azure server:
c:\git\yoursite> git push https://[email protected]:443/yoursite.git
Azure will add the node dependencies and run your site on port 80.
Upvotes: 0
Reputation: 9022
If you want to run node
app on port 80
, then you have to run it with sudo
privileged account.
For windows, probably, restarting iis node can resolve the issue.
run node.js webbapp on 80 port on windows
Upvotes: 2
Reputation: 24148
I want to reproduce the issue via create an Azure VM using the image Windows Server 2012 R2 DataCenter
from gallery, but failed that the node app works on port 80.
Per my experience, there are some steps you can try to resolve the issue.
Command Prompt
and right click to select the option Run as administrator
to startup the cmd
for running node or others as administrator.netstat -ao
to display the all listening ports and their PID, then find the one of Local Address 0.0.0.0:80
and command taskkill /PID <PID> /F
to forcefully terminate the process ran on port 80.node app.js
again.Upvotes: 0