Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

iisnode fails to start your Node.js app under IIS

ErrorIIS reporting error code 0x5 (ERROR_ACCESS_DENIED)

Short answer

When iisnode cannot start your app, IIS shows an error page and the cause is in the details. The three confirmed causes are: the app pool identity cannot read and run node.exe, the iisnode build does not match the Windows bitness, or iisnode is not pointed at the right node.exe. Turn on iisnode logging first.

  • Applies to iisnode on IIS, Windows Server, node.exe 64-bit
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Make iisnode capture what node.exe writes to stdout and stderr, and show detail in the error page. In web.config, check that loggingEnabled is true and note the logDirectory (a folder next to your main file, default name iisnode). Then read the newest file in it.

    <!-- web.config -->
    <iisnode loggingEnabled="true" logDirectory="iisnode" devErrorsEnabled="true" />
  2. 2Match what you see, then jump to its fix

    1. 1IIS reporting error code 0x5 (ERROR_ACCESS_DENIED)The app pool identity cannot run node.exeFix
    2. 2The module installed fine but no request ever reaches node, or IIS Express and full IIS behave differentlyThe iisnode build does not match the Windows bitnessFix
    3. 3Nothing starts, and node.exe is installed in a folder other than the defaultiisnode is not told where node.exe livesFix

What does the error look like?

  • IIS reporting error code 0x5 (ERROR_ACCESS_DENIED)
  • 503 response from a site that works when you run node server.js by hand

Cause 1 of 3

The app pool identity cannot run node.exe

1Check

Error 0x5 is access denied. The default pool identity (ApplicationPoolIdentity) belongs to the IIS_IUSRS group, so check what that group may do to the node.exe folder.

icacls C:\node\node.exe

2Fix

Give IIS_IUSRS read and execute rights on node.exe. The iisnode FAQ shows this form for a node.exe in a folder on the system drive.

icacls %systemdrive%\node\node.exe /grant IIS_IUSRS:rx

3Verify

Recycle the application pool and request the site again.

iisreset

Confirmed by github.com

Did this fix it?

Cause 2 of 3

The iisnode build does not match the Windows bitness

1Check

iisnode ships separate x86 and x64 MSI packages and the README says to match your system. IIS Express always uses the x86 build, as the FAQ notes.

systeminfo | findstr /C:"System Type"
dir "%programfiles%\iisnode"

2Fix

Install the iisnode package whose bitness matches your Windows. For IIS Express on 64-bit Windows, install the full x64 version or the separate iisnode express version.

echo Reinstall iisnode using the MSI that matches the System Type printed above

3Verify

Request the site again and read the newest log file.

dir iisnode

Confirmed by github.com

Did this fix it?

Cause 3 of 3

iisnode is not told where node.exe lives

1Check

The nodeProcessCommandLine setting is the command line iisnode uses to start the node executable. The sample web.config shows it as %programfiles%\nodejs\node.exe. Compare that with where node.exe really is.

where node

2Fix

Set nodeProcessCommandLine to the full path of the node.exe you installed.

<iisnode nodeProcessCommandLine="&quot;%programfiles%\nodejs\node.exe&quot;" />

3Verify

Recycle the pool and request the site again.

iisreset

Confirmed by github.com

Did this fix it?

How do I stop it coming back?

  • Keep node.exe in a fixed folder that IIS_IUSRS can read, and write that path down for each server.
  • Leave loggingEnabled on during rollout and read the iisnode log folder after each deploy.
  • Install the iisnode MSI that matches the server's bitness, and record the version.
  • Turn devErrorsEnabled off once the site is live so detail is not sent to browsers.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

ng serve says it cannot determine the project or target

Cannot determine project for command.

The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.

3 causes, each with a fix

Back end

ng serve cannot find the dev-server builder package

Could not find the implementation for builder @angular/build:dev-server

The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.