I've set IISNode up on a server, and followed a guide to get a simple hello world node.js app running with it. It works fine and it's externally accessible via the internet. However, when I try to incorporate my existing express app, it's like node/express aren't even there.
This is my web.config file:
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
</system.webServer>
</configuration>
That is at the IIS application's root directory, along with app.js which is my main express file. What's interesting is if I go to localhost/TestApp/app.js, I get back:
Cannot GET /TestApp/app.js
However, if I try a different file, like localhost/TestApp/public/htm/index.htm, I get back the file that is located there (in HTML, as expected). Also, if I try and do a server call (e.g. localhost/TestApp/GetUsernames).
What's even more interesting is that if I mess up the port (e.g. app.listen(process.env.PORT2 );), I get this when I try and access localhost/TestApp.js:
> iisnode encountered an error when processing the request. > > HRESULT: 0x2 HTTP status: 500 HTTP reason: Internal Server Error
If the port is correct (app.listen(process.env.PORT2);), I get Cannot GET /TestApp/app.js, so it does look like IISNode is executing app.js (how else would it be failing when I mess up the port), but nothing seems to be working.
How might I fix this, or at least diagnose the problems?
Thank you.
You probably need to add a
<rewrite>
section to clarify how to route the requests:Pulled from an example Azure node.js app.