Demeteorized my app, now I want to host it in IIS

Hi all,

After some struggles I finally got my Meteor app demeteorized and running via Node instead of meteor.

Now I want to host it in IIS.

I have downloaded and installed iisnode and got the samples working. But I cannot find a way, and cannot find any articles on how to serve my demeteorized application in IIS.

What I’ve tried so far is setting up another folder in the demo site containing my demeteorized bundle, with a small web.config that instructs iisnode to load main.js, like this:

      <add name="iisnode" path="main.js" verb="*" modules="iisnode" />

When I browse to the site, I get this message:

The iisnode module is unable to start the node.exe process. Make sure the node.exe executable is available at the location specified in the system.webServer/iisnode/@nodeProcessCommandLine element of web.config. By default node.exe is expected in one of the directories listed in the PATH environment variable.

Of course, node is definitely in the PATH. I am able to run it from the command line. And the other demos load fine.

Any thoughts on where to go from here would be appreciated!

Thought I’d provide an update since I’ve been working on this for a few hours now and made some progress.

Although node is definitely in my PATH, I decided to set the location of node manually in the web.config, so now it looks like this:

<?xml version="1.0" encoding="UTF-8"?>
        <iisnode nodeProcessCommandLine="C:\Program Files (x86)\nodejs\node.exe" />
            <add name="iisnode" path="main.js" verb="*" modules="iisnode" />
                <add value="main.js" />

I also added a defaultDocument so when I browse to, for example, http://localhost:81/myapp it will load myapp/main.js.

I had to make sure the environment variables MONGO_URL and ROOT_URL were set, too.

Now the problem is that when I browse to this application, it starts to load a few things; the title of the page is displayed, some of the elements are rendered, but the console reports errors trying to load other .css and .js files.

If I start the application outside of IIS (using node main.js) I am able to browse to the site without any of these errors, so I imagine IIS is doing something with the routing?

I feel like I’m very nearly there with it, and that this is the final hurdle.

After setting the ROOT_URL to include the main.js filename, the application starts in IIS. However, the URL will always display the name of the file. All of our routes defined in FlowRouter appear after the main.js file, example:

It looks a bit odd, but I can’t figure out a way to get around it. Any ideas?

I would like to condense it down so that it displays something like http://localhost:81/route1/route2

Haven’t had a chance to read through the specific issues you are facing, but we are running on IIS in production with a config based on the azure-demeteorizer repo (see web.config here). Maybe that provides any insight/inspiration?

1 Like

Thanks @ramijarrar, your rewrite rules were exactly the thing I was after. The app is now working flawlessly in IIS.

I’m having problems again since updating to Meteor 1.4.1.

The demeteorized application works when running node main.js and I do not encounter any errors or issues with the application.

But when I try to browse to the site in IIS, it fails to load the page.

The IIS site has its binding set to port 80, and the demeteorized app is running on port 8080 (trying to run it on port 80 generates an error because IIS is already bound to that port).

When I try to browse to http://localhost I am presented with the error:

iisnode encountered an error when processing the request.

HTTP status: 500
HTTP subStatus: 1001
HTTP reason: Internal Server Error

But now that I have browsed to the page, it fires up a node process and I can then browse to http://localhost:8080 without any issues.

How can I get iisnode to serve up the page on port 80 again?

Were you able to get past this? I’ve created a simple app (meteor create) and trying to make it run today with iisnode but getting errors loading the first guid.js file (console error, white page otherwise)