Anyone have Meteor working with Window Server + IIS + IISNode?

I’ve exported my Meteor 1.1 app using meteor build and set it up on Windows Server 2012 R2 x64. I’ve got Mongo, Node, etc… all set up and can successfully run the app via the command line on an alternative port (e.g. 3000). So by visiting http://myapp.mydomian.com:3000 the app works just fine. However, IIS is taking up port 80 and is hosting a couple other sites. I’ve been trying to use the IISNode module, but am getting errors regarding ‘named pipes’. According to others, named pipes are supported as ports in Meteor.

Is anyone else successfully hosting a Meteor app on Windows Server + IIS + IISNode? If so, what did your web.config look like? Any special steps you took to set up Meteor (as opposed to any other Node app)?

For a full outline of my environment and error output, see the issue I opened on GitHub:

Hi Eric,

Here are a few steps to get it work on IIS using IISNode. Install Visual Studio 2013 or 2015, NodeJS 0.12.6 and Python 2.7.10.

Step 1. ‘Meteor build --directory …\build’ in the meteor app folder
Step 2. Run ‘npm install’ in the …\build\bundle\programs\server folder
Step 3. Change ‘parseInt(process.env.PORT)’ to ‘process.env.PORT’ in …\build\bundle\programs\server\packages\webapp.js
Step 4. Add package.json in .\build\bundle (OPTIONAL)

{
“name”: “AppName”,
“version”: “1.0”,
“main”: “main.js”,
“scripts”: {
“start”: “node main.js”
},
“engines”: {
“node”: “0.12.6”
}
}
Step 5. Add web.config in …\build\bundle\ with the rewriterules.
Step 6. You should have a working Meteor App.

Niels Weistra

Thanks for the reply. I’m able to get it working with IISNode after editing the webapp.js file (like you suggested), but I hate the idea of editing a core Meteor file.

I resorted to using the PM2 package to start and monitor my application on Windows Server, then use Application Request Routing and a reverse proxy site on IIS to forward traffic to the app. It seems to be working, and PM2 can monitor, restart, and log just fine.

It would be nice to use IISNode, as it’s a more integrated and elegant solution for Windows Server, but this issue needs to be resolved first: https://github.com/meteor/meteor/issues/4413

node 0.10.40 worked for me

however I am not able to figure out how hot-code-push would work between two builds

I did the same, however, the way I had the reverse proxy on IIS to use a sub folder on the domain threw me of.

I was not aware that by using ROOT_URL we could specify the a sub path.

example, if i run the following command inside my meteor app folder:

set ROOT_URL=http://localhost:3100/n/todos && meteor

I will be able to access my app at http://localhost:3100/n/todos, notice I omitted the trailing /. And if we try to surf to the address http://localhost:3100/n or http://localhost:3100/ will give us an error Unknown path.

So, when I first setup the reverse proxy, I was getting the Unknown Path error every time.

Turns out that on my IIS config, I have to specify the http://localhost:3100/n/todos as the url value on the action, please notice the “n/todos” at the end.

So my rewrite rule ended up like this:
[file @ c:/inetpub/wwroot/web.config]

<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="TODOs meteor app. Route the requests" stopProcessing="true" enabled="true">
          <match url="^n/todos/(.*)" />
          <conditions>
            <add input="{CACHE_URL}" pattern="^(https?)://" />
          </conditions>
          <action type="Rewrite" url="{C:1}://localhost:3100/n/todos/{R:1}" /> <!-- I was missing the /n/todos here -->
          <serverVariables>
            <set name="HTTP_ACCEPT_ENCODING" value="" />
          </serverVariables>
        </rule>
      </rules>
      <outboundRules>
        <rule name="TODOs ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1" enabled="false">
          <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://localhost:3100/(.*)" />
          <action type="Rewrite" value="/n/todos/{R:2}" />
        </rule>
        <rule name="TODOs RewriteRelativePaths" preCondition="ResponseIsHtml1" enabled="false">
          <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/(.*)" negate="false" />
          <action type="Rewrite" value="/n/todos/{R:1}" />
        </rule>
        <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
          <match filterByTags="A, Form, Img" pattern="^http(s)?://localhost:3100/(.*)" />
          <action type="Rewrite" value="http{R:1}://localhost/{R:2}" />
        </rule>
        <preConditions>
          <preCondition name="ResponseIsHtml1">
            <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
          </preCondition>
        </preConditions>
      </outboundRules>
    </rewrite>
  </system.webServer>
</configuration>

Is this working for anyone these days? I see this is from 2015. I just created a test project (hello) which runs on its own. Following these steps I get a white screen in the browser. No logs, nothing useful to track further. The samples from iisnode are running just fine but those are simple single-file node apps - not meteor.

Inspecting the console, I see it got html but now can’t get the js resources.

main.js:14 GET http://localhost/b8a66218ab53f97b8e6c172d63a8f27e7037c0a8.js?meteor_js_resource=true