3

So, here is my situation.This is my first time deploying a node application in Windows. So, far I have been frustrated to the extreme. The problem is routing the url. I have written a very simple testapplication and wanted to test it in Windows after deploying it in IIS node. But then for some reason, I keep getting this error "cannot GET (whatever I key in)" This is what I tried so far web.config file-

<configuration>
  <system.webServer>

    <!-- indicates that the hello.js file is a node.js application 
    to be handled by the iisnode module -->

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

    <!-- use URL rewriting to redirect the entire branch of the URL namespace
    to hello.js node.js application; for example, the following URLs will 
    all be handled by hello.js:



    -->

    <rewrite>
      <rules>
        <rule name="myapp">
          <match url="myapp/*" />
          <action type="Rewrite" url="hello.js" />
        </rule>
      </rules>
    </rewrite>

  </system.webServer>
</configuration>

server file (hello.js)-

var express = require('express');

var app = express.createServer();

app.get('/myapp/foo', function (req, res) {
    res.send('Hello from foo! [express sample]');
});

app.get('/myapp/bar', function (req, res) {
    res.send('Hello from bar! [express sample]');
});

app.listen(process.env.PORT);

After trying this - This is what I get 1. http://localhost:4500/node/TestApp/myapp/foo - "Cannot GET /node/TestApp/myapp/foo" 2. http://localhost:4500/node/TestApp/myapp- "Cannot GET /node/TestApp/myapp"

Please help me out of this mess.

Rachel Morris
  • 127
  • 5
  • 11
  • I don't know much about IISNode, but i can tell that you should definitely go with `HttpPlatformHandler`. Is the official IIS module, from Microsoft, to suit this kind of needs. I use it to run Node.js on IIS 7.5. see: https://www.iis.net/downloads/microsoft/httpplatformhandler – Diego ZoracKy Mar 27 '17 at 14:37

0 Answers0