Node.js Using IISNode to host Node.js Web Apps in IIS


Virtual Directory / Nested Application with Views Pitfall

If you're going to be using Express to render views using a View Engine, you'll need to pass the virtualDirPath value in to your views

`res.render('index', { virtualDirPath: virtualDirPath });`

The reason for doing this is to make your hyperlinks to other views host by your app and static resource paths to know where the site is being hosted without needing to modify all views after deployment. This is one of the more annoying and tedious pitfalls of using Virtual Directories with IISNode.


All of the examples above work with

  • Express v4.x
  • IIS 7.x/8.x
  • v1.3.x or greater