Yes, it is possible using 2 different solutions:
You may have a background launch task that launches node.exe with the required parameters. Nothing changes for your ASP.NET application, the only thing you need to do is include the node files in this project and reference this directory when you run node.exe
Use iisnode . This allows you to run your node code through the IIS HttpModule, which brings with it additional nice features (to quote Tomasz Janczuk):
- Process management. The iisnode module takes care of lifelong process control for node.exe, which simplifies overall reliability. You do not need to implement the infrastructure to start, stop and monitor processes.
- Scalability on multi-core servers. Since node.exe is a single-threaded process, it scales only to one processor core. The iisnode module allows you to create several node.exe processes for each application, and loading balances the HTTP traffic between them, which allows you to fully use the server capacity without requiring additional infrastructure code from the application developer.
- Automatic update. The iisnode module ensures that whenever a node.js application is updated (i.e. the script file has been modified), the node.exe processes are processed. Current requests allow you to legally complete execution using the old version of the application, and all new requests are sent to the new version of the application.
- Access to logs through HTTP. The iisnode module provides access to the node.exe output process (for example, generated by console.log calls) via HTTP. This tool helps you debug node.js applications deployed on remote servers.
- Next to other types of content. The iisnode module integrates with IIS so that a single website contains many types of content. For example, one site may contain a node.js application, static HTML and JavaScript files, PHP applications, and ASP.NET applications. This allows you to choose the best tools for work, as well as the gradual migration of existing applications.
- Minimal changes to node.js. application code The iisnode module allows you to host existing node.js HTTP applications with minimal changes. Usually all that is required is to change the specified HTTP server address to one provided by the iisnode module using the process.env.PORT environment variable.
- Integrated Management Experience. The iisnode module is fully integrated with IIS and uses the same tools and mechanism as other IIS components for configuration and maintenance. In addition to the advantages typical of the iisnode module, hosting of node.js applications in IIS allows the developer to use a number of IIS functions, including:
- port sharing (hosting multiple HTTP applications over port 80)
- security (HTTPS, authentication and authorization)
- URL Rewriting
- compression
- caching
- entry
source share