2013-08-10 1 views
2

저는 iisnode에서 노드 응용 프로그램을 실행하려고했습니다. 이 응용 프로그램은 node.js에서 원활하게 실행되며 아무런 문제가 없습니다. 그러나, 나는 iisnode를 사용하여 iis에서이 응용 프로그램을 실행하려고 했으므로 asp.net 응용 프로그램에이 응용 프로그램을 통합해야합니다! 하지만 난 어려움에 직면 해왔다. config 또는 server.js 파일을 변경하여 작동시킬 필요가있는 것이 있는지 궁금합니다.node.js에서 iisnode로 전환 할 때 변경해야 할 사항은 무엇입니까?

감사합니다.

답변

1

노드 응용 프로그램에 필요한 유일한 변화가있을 것입니다 포트 번호 - (마지막 줄 알) 공식 /src/samples/express/hello.js에 명시된대로 server.js/app.js 대신 특정 숫자의 process.env.PORT 값을 사용

을 또한
var express = require('express'); 

var app = express.createServer(); 

app.get('/node/express/myapp/foo', function (req, res) { 
    res.send('Hello from foo! [express sample]'); 
}); 

app.get('/node/express/myapp/bar', function (req, res) { 
    res.send('Hello from bar! [express sample]'); 
}); 

app.listen(process.env.PORT); 

asp.net의 의 web.config이 (/src/samples/express/web.config에서 촬영) 노드에 대한 부분이 있는지 확인하십시오 :

<configuration> 
    <system.webServer> 

    <!-- indicates that the hello.js file is a node.js application 
    to be handled by the iisnode module --> 

    <handlers> 
     <add name="iisnode" path="hello.js" verb="*" modules="iisnode" /> 
    </handlers> 

    <!-- use URL rewriting to redirect the entire branch of the URL namespace 
    to hello.js node.js application; for example, the following URLs will 
    all be handled by hello.js: 

     http://localhost/node/express/myapp/foo 
     http://localhost/node/express/myapp/bar 

    --> 

    <rewrite> 
     <rules> 
     <rule name="myapp"> 
      <match url="myapp/*" /> 
      <action type="Rewrite" url="hello.js" /> 
     </rule> 
     </rules> 
    </rewrite> 

    </system.webServer> 
</configuration> 
관련 문제