- Open Control Panel.
- Navigate to Programs > Turn Windows features on or off.
- Scroll down and check the box for Internet Information Services (IIS).
- Expand the IIS tree and ensure the following components are selected:
- Web Management Tools
- World Wide Web Services
- Application Development Features (ensure CGI and ISAPI Extensions are checked)
- Click OK and wait for IIS to install.
- Download and install the IIS URL Rewrite Module from the Microsoft website. This module allows IIS to act as a reverse proxy, forwarding requests to your Node.js app.
- Download iisnode from the iisnode GitHub releases page.
- Install it on your machine. IISNode allows you to host Node.js applications in IIS.
- Open IIS Manager (type
inetmgr
in the Start menu search). - Right-click Sites and choose Add Website.
- Set the Site name, the Physical path (the folder where your Node.js app is located), and choose a Port (e.g., 8080).
- Click OK.
- In IIS Manager, select your site, then double-click on the URL Rewrite option.
- Click Add Rule(s) in the Actions pane on the right, then choose Reverse Proxy.
- If prompted, enable Application Request Routing (ARR) by clicking on the prompt at the top of the window and checking the box.
- In the Reverse Proxy Rules dialog, enter the Node.js app's hostname and port (e.g.,
localhost:3000
). - Click Apply.
In the root of your Node.js application directory, create a web.config
file with the following content:
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="Node.js app">
<match url="/*" />
<action type="Rewrite" url="server.js" />
</rule>
</rules>
</rewrite>
<iisnode
devErrorsEnabled="true"
loggingEnabled="false" />
</system.webServer>
</configuration>
Grant Permissions
- Navigate to your application's directory in the file system.
- Right-click the folder, select Properties, and go to the Security tab.
- Add the application pool identity (e.g., IIS AppPool\DefaultAppPool) and grant Read & Execute and Write permissions.
- Url:
/print
- Method:
POST
- Body :
{
"url": []
}