Routing on IIS Windows Server Not Working

I’ve read everything here about routing issues on IIS and spent about ten hours on this so far - I’m banging my head now (I’m sure you all know the feeling har har). My issue is relatively straightforward, I’m working with NodeJS on a Windows / IIS server. Routing enabled, links are relative to site root.

My test.ejs page route properties are:
image

Routing works fine on my local Windows machine but once uploaded to the server it falls down. I have URL rewriting module installed in IIS and working on the server, it’s doing other redirects just fine so I know that parts OK.

It looks to me like the web.config file isn’t set up correctly.

Can someone please point me in the right direction for what I need to do to my web.config file to make this work? I reckon its this bit that isn’t formatted correctly:

<match url="^.*/views/([^/]+?)(?:/)?$" ignoreCase="true" />

Does anyone know what the actual url is that Wappler uses for routing? I’m guessing at /views/ but its looking like it’s something else.

Wappler automatically creates an htaccess file for Apache servers, it’d be great if it also created a web.config file for IIS too.

Anyway… Here’s what I have in total for context:

<rewrite>
<rules>
<!-- Wappler routing -->
<rule name="wappler rewrite Views" stopProcessing="true">
  <match url="^.*/views/([^/]+?)(?:/)?$" ignoreCase="true" />
  <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  </conditions>
  <action type="Rewrite" url="/{R:1}" appendQueryString="true" />
</rule>
<!-- End Wappler routing -->
</rules>
</rewrite>

Any help is greatly appreciated.!

Update: I just tried switching off routing then deleted all files and re-uploaded and the same thing is happening. I’m getting a 404 when trying to view in a browser the server side.

I tried to publish again to remote host and used the debugger facility, here’s what it threw up:

<--- 150 Opening ASCII mode data connection.
---- Accepted data connection from (85.13.226.238) port 20
---- Got EOF on data connection
---- Closing data socket
<--- 226 Transfer complete.
---> TYPE I
<--- 200 Type set to I.
---> MDTM index.ejs
<--- 213 20220713152550
---> MDTM layouts
<--- 550 The specified path is invalid.
---> MDTM partials
<--- 550 The specified path is invalid.
---> MDTM yet-another-test.ejs
<--- 213 20220713155131
---- CWD path to be sent is `/app'
---> CWD /app
<--- 250 CWD command successful.
---> TYPE A
<--- 200 Type set to A.
---> PORT 172,20,1,250,95,46
<--- 200 PORT command successful.
---> LIST -a
---- Accepted data connection from (85.13.226.238) port 20
<--- 125 Data connection already open; Transfer starting.
---- Got EOF on data connection
---- Closing data socket
<--- 226 Transfer complete.
---> TYPE I
<--- 200 Type set to I.
---> MDTM .dockerignore
<--- 213 20220713150850
---> MDTM .npmrc
<--- 213 20220713150851
---> MDTM __restart_node__.txt
<--- 213 20220713155129
---> MDTM app
<--- 550 The specified path is invalid.
---> MDTM index.js
<--- 213 20220713150852
---> MDTM lib
<--- 550 The specified path is invalid.
---> MDTM package-lock.json
<--- 213 20220713151129
---> MDTM package.json
<--- 213 20220713152346
---> MDTM public
<--- 550 The specified path is invalid.
---> MDTM tmp
<--- 550 The specified path is invalid.
---> MDTM views
<--- 550 The specified path is invalid.
Removing old file `__restart_node__.txt'
Transferring file `__restart_node__.txt'
---> DELE __restart_node__.txt
<--- 250 DELE command successful.
---> PORT 172,20,1,250,95,47

As far as I can see the only place I can specify a file path is in the PLESK set up - which looks correct according to what was listed in a thread in this support forum:

Hi Tom, I had a similar setup for one of the sites without PLESK. For a NodeJS site to run on IIS, the following set up was required on the Windows Server.

  1. IIS - URL Rewrite & ARR (Application Request Routing) extensions
  2. Install NodeJS locally
  3. Install pm2 Node Package to keep node server running/connection alive on the Windows server - pl. check the commands on their site for the setup
  4. Reverse Proxy under the IIS web server NodeJS site settings to access NodeJS server port, generally 3000
1 Like

thank you for taking the time to do that, I have all of the above running on the server, it was installed automatically within the PLESK UI.

I’ve just noticed the latest version I’m running is NodeJS V12 which is no good as its got a fair few vulnerabilities, I can only add new versions through PLESK and they seem slow in rolling out updates for this (it’s now up to V18) so I’m reluctantly forced to ditch my NodeJS work and revert back to ASP.NET.

PLESK is not required to run NodeJS apps on IIS. Node apps run perfectly okay by using Reverse Proxy method and any version of NodeJS can be installed on the windows server.

Hi @guptast you are available to setup my server windows/iis to works with wappler nodejs? how will be the cost? thanks!

There is somebody available? Thanks!!

Hi @AlexandreMoreira,

This is the link with instructions to setup nodeJS application on a Windows Server running IIS.

https://dev.to/petereysermans/hosting-a-node-js-application-on-windows-with-iis-as-reverse-proxy-397b

If you have any issues, post them in the forum here; I will assist you in troubleshooting and resolving these.

1 Like

There’s also a slightly different approach, if you are running PLESK on your Windows box, install NodeJS package automatically from your extensions link, its a two click process and very smooth.

Tks @TMR, but i use a VPS Windows on AWS, it is no PLESK, but i read many links and it is so hard to install!!! :pensive: