Compartilhar via


Node.js errors with WebMatrix on IIS 8 (Windows 8 RTM)

After installing Node.js to try my hand at some server side JavaScript using WebMatrix, I was getting a 500 internal server error.

This is what was returned to the browser:

iisnode was unable to read the configuration file. Make sure the web.config file syntax is correct. In particular, verify the  <a href=https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config>iisnode configuration section</a> matches the expected schema. The schema of the iisnode section that your version of iisnode requires is stored in the %systemroot%\system32\inetsrv\config\schema\iisnode_schema.xml file.

I had multiple issues.

First, per this page (thank you Scott and commenters):

https://www.hanselman.com/blog/InstallingAndRunningNodejsApplicationsWithinIISOnWindowsAreYouMad.aspx

I changed the application pool to run as LocalSystem.

I was still getting the same error message.  I look into the applicationHost.config file and noticed:

<section name="handlers" overrideModeDefault="Deny" />

Since the handler for IISNode was in the web.config this looked like an issue.  I changed it to:

<section name="handlers" overrideModeDefault="Allow" />

After this change the page loaded successfully. 

There was one other change I made that I am not sure had any impact, but I will mention it just in case.  The web.config color coding was messed up in WebMatrix.  Deleting the comments at the top of the file resolved this.

Since searching for the above error message returned no results except for a bug in our internal KB.  I thought I would throw this out there in case it helps someone else.

Wait, what does this have to do with SharePoint?  In the new app model in Office and SharePoint 2013, every web technology is potentially a SharePoint application.  I am looking forward to branching out.