Search code examples
node.jsiiswindows-11iisnode

iisNode default install failing in Windows 11, 500.19 Internal Server Error


With Node v18.17.0 installed on my new Windows 11 computer, which is running IIS v10.0.22621.1, I proceeded to download iisNode (v0.2.26 dated 2/21/2017) and MS urlRewrite. I have been following the instructions from Harvey Williams ( https://www.youtube.com/watch?v=JUYCDnqR8p0, also read his blog post (although it is a bit dated, 2016). The final step of the instructions instructed me to change directories to "C:\Program Files\iisNode" and run setupSamples.bat (no errors) and when it was done I opened my browser to http://localhost/node. This displayed the expected page with several sample links.

Problem none of the sample links work! They all return the same IIS 500.19 error page.

The exact Error Code is: 0x80070021.

The Config Error reads: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

Requested URL: http://localhost:80/node/helloworld/readme.htm

Physical Path: c:\Program Files\iisnode\www\helloworld\readme.htm

In the Config Source section of the IIS error page, it reads:

35: to be handled by the iisnode module -->
36: <handlers>
37: <add name="iisnode" path="hello.js" verb="*" modules="iisnode" /> 

Although, I'm no windows OS expert, it seems odd to me that the iisNode installer created a web server folder under Program Files. And as the Config Error message above reads, perhaps there is a permission setting in the parent folder. The Program Files\iisNode does not have any IIS_IUSER account but the subfolder that is trying to be accessed \www does have Full Control.

Not clear either, if the default website application pool could be causing the problem but his is how the "node" website was added to IIS by the installer.

For reference, the web.config file contains the following:

    <?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <!-- indicates that the hello.js file is a node.js application 
        to be handled by the iisnode module -->
        <handlers>
        <add name="iisnode" path="hello.js" verb="*" modules="iisnode" />
        </handlers>
        <!-- use URL rewriting to redirect the entire branch of the URL namespace
        to hello.js node.js application; for example, the following URLs will 
        all be handled by hello.js:
        
            http://localhost/node/urlrewrite/hello
            http://localhost/node/urlrewrite/hello/foo
            http://localhost/node/urlrewrite/hello/foo/bar/baz?param=bat
            
        -->    
        <rewrite>
        <rules>
            <rule name="hello">
            <match url="hello/*" />
            <action type="Rewrite" url="hello.js" />
            </rule>
        </rules>
        </rewrite>
    </system.webServer>
</configuration>

Before I fallback to Windows 10 on this new machine and try again, I'm hoping someone can confirm that iisNode as referred to in stackOverflow Post and referenced to this Microsoft github fork will actually run in Windows 11 (IIS v10) and perhaps suggest what permissions or other possible configuration settings might be incorrect.


Solution

  • Wow, I found the answer after several more hours of searching. The various download versions and configuration settings are almost completely correct. The problem issue goes back to installing IIS on the machine. I am only guessing but on prior Windows versions IIS must have installed with more features turned on because the required features are not described in any help documentation that I have read. I found and read IIS Config Error which described enabling all but CGI under "Application Development Features". After doing this and restarting IIS, the setupSample pages all worked.

    Hope this save somebody else the day I spent figuring this out, now back to coding!