Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
500 views
in Technique[技术] by (71.8m points)

node.js - How to serve NodeJS application from IIS/Windows Server Edition OS without using iisnode?

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.

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?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Option 1:

  1. Run your Node.js app at a local binding such as http://localhost:8080 Reference
  2. Set up IIS as reverse proxy Reference

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.

Option 2:

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=".
ode.log" startupTimeLimit="20" processPath="C:Program Files
odejs
ode.exe" arguments=".app.js">
            <environmentVariables>
                <environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
                <environmentVariable name="NODE_ENV" value="Production" />
            </environmentVariables>
        </httpPlatform>
  </system.webServer>
</configuration>

Reference


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...