Sekrab Garage

IIS Node Module

When deploying node on IIS with different environment variable on remote host

GitTipIIS April 1, 21
Subscribe to Sekrab Parts newsletter.

Run Nodejs continiously under IIS using IISNode Module, obviously not maintained any longer, but the module is so simple it need not any more maintenance. In web.config you can set the environment variable. Now you need to push to a host that runs IIS, in my case it was Azure.

In Azure hosting, deployment options, you can connect to a VisualStudio (DevOps) account, and continiously pull from the git repo. Now here is the challenge, have a web.config with a different environment variable on the host. Using the web.release.config and web.debug.config, did not do the trick. So set envrionemnt to production first:

<add key="node_env" value="production" />

Then push to git respositry. Then ignore it:

git update-index --assume-unchanged web.config

Finally, change the local web.config to any environment, and push as usual. The file changes will always be ignored.