| Start |
|---|
| Using an IIS Virtual Directory or Nested Application via Using a Virtual Directory or Nested Application in IIS is a common scenario and most likely one that you'll want to take advantage of when using IISNode. IISNode doesn't provide direct support for Virtual Directories or Nested Applications via configuration so to achieve this we'll need to take advantage of a feature of IISNode that isn't part of the configuration and is much lesser known. All children of the Lets create a Virtual Directory in our Within our Node.js App we can access the Now that we can use the We can use the virtualDirPath with our static resources as well Lets put all of that together |
| Getting Started IISNode (opens new window) allows Node.js Web Apps to be hosted on IIS 7/8 just like a .NET application would. Of course, you can self host your IISNode will handle scaling over multiple cores, process manageement of RequirementsIISNode does have a few requirements before you can host your Node.js app in IIS.
|
| Basic Hello World Example using Express To get this example working, you'll need to create an IIS 7/8 app on your IIS host and add the directory containing the Node.js Web App as the Physical Directory. Ensure that your Application/Application Pool Identity can access the Node.js install. This example uses the Node.js 64-bit installation. Project StrucureThis is the basic project structure of a IISNode/Node.js Web app. It looks almost identical to any non-IISNode Web App except for the addition of the server.js - Express ApplicationConfiguration & Web.configThe ConfigurationYou can configure IISNode by using a IISNode HandlerIn order for IIS to know that URL-Rewrite RulesThe final part of the configuration is ensuring that traffic intended for our Node.js app coming into our IIS instance is being directed to IISNode. Without URL rewrite rules, we would need to visit our app by going to This is a working That's it, now visit your IIS Site and see your Node.js application working. |
| Using Socket.io with IISNode To get Socket.io working with IISNode, the only changes necessary when not using a Virtual Directory/Nested Application are within the Since Socket.io sends requests starting with In addition to the changes to the If you are using IIS 8, you'll need to disable your webSockets setting in your
RemarksVirtual Directory / Nested Application with Views PitfallIf you're going to be using Express to render views using a View Engine, you'll need to pass the 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. VersionsAll of the examples above work with
|
Read Article
https://develop.horje.com/learn/1434/reference