IIS 7 and Above
Angular 2 site won't work on Windows Server 2016
Last post Jan 25, 2018 09:06 AM by Yuk Ding
Jan 24, 2018 06:08 PM|gib65|LINK
I'm following along in this video tutorial in order to learn how to deploy our Angular 2 site to a Windows Server 2016 machine:
Everything the video suggests works. I've got IISNode, Node Express, and the starter Angular 2 application all working.
Now I want to deploy my much more complex Angular 2 application. It was originally designed to run on Linux so I'm not sure what to tweak to get it to run on Windows Server 2016. I'm told I can just take the contents of dist and plop into into the website
folder on Windows Server 2016. That's what I did.
When I browse to it on the server, however, I get this:
The stack trace tells me it got to server.js, so that's a good sign. Where things seem to be fouling up is when it looks for module.js. I did a search on the server for module.js and couldn't find it. The stack trace ends with a failure to find the module
'compression'. <-- I'm not sure what this is.
Here is my web.config:
<!-- indicates that the server.js file is a node.js application to be handled by the iisnode module -->
<add name="iisnode" path="server/server.js" verb="*" modules="iisnode" />
<match url="/*" />
<action type="Rewrite" url="server/server.js" />
Can someone please help me troubleshoot this?
Jan 25, 2018 09:06 AM|Yuk Ding|LINK
I just noticed that the video also display the similar issue with cannot find module expression. So have you tried to use command line cd to your website folder and run "npm install compression" to fix this issue? I'm sorry that I'm not familar with node.js
so we need to ensure it is not an node.js side issue. Then we could focus on the configuration on IIS.
Here are the other solutions for this issue: