如何在不使用iisnode的情况下从IIS/Windows Server Edition OS服务NodeJS应用程序? [英] How to serve NodeJS application from IIS/Windows Server Edition OS without using iisnode?
问题描述
因此,我在具有Server Edition OS的Windows上编写了一个NodeJS应用程序,通过使用NodeJS子进程执行一些命令,我的应用程序基本上与安装在同一系统中的其他软件进行通信.
So, I've written a NodeJS application on Windows having Server Edition OS, My application basically communicates with other Softwares installed in the same system by executing some commands using NodeJS child process.
一切都可以在localhost上正常运行,因为我的服务器具有静态IP,所以我希望将应用程序公开.不使用iisnode怎么办?
Everything is working fine on localhost, as my server has a static IP, I want to serve the application to public. How can I do this without using iisnode?
我尝试使用iisnode,但是从那时起我就陷入了麻烦,我能够为我的站点提供服务器,但是由于C驱动器上的某些权限问题,cmd命令给出了Access Denied错误.
I tried using iisnode, but I am falling into issues since then, I am able to server my site, but due to some permission issues on C drive, the cmd command gives Access Denied error.
推荐答案
选项1:
- 在本地绑定(例如
http://localhost:8080
参考
- Run your Node.js app at a local binding such as
http://localhost:8080
Reference - Set up IIS as reverse proxy Reference
iisnode在应用程序池集成等方面提供了更好的控制,但是由于它是一个死项目,因此您绝对不应再使用它.
iisnode provides better control on application pool integration and so on, but since it is a dead project you definitely shouldn't use it any more.
选项2:
使用HttpPlatformHandler启动您的Node.js应用程序,
Use HttpPlatformHandler to launch your Node.js app,
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httppPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\node.log" startupTimeLimit="20" processPath="C:\Program Files\nodejs\node.exe" arguments=".\app.js">
<environmentVariables>
<environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
<environmentVariable name="NODE_ENV" value="Production" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
这篇关于如何在不使用iisnode的情况下从IIS/Windows Server Edition OS服务NodeJS应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!