Express在windows IIS上部署详解

最近公司在用Express+angularjs+wcf开发系统,让我在windows上部署系统,遇到不少问题,不过最后还是解决了,在IIS上部署系统,

首先windows需安装以下软件:

1.nodejs;

2.iisnode;

3.rewrite;

安装这三个软件后,之后部署和部署asp.net程序一样,这里就不多说了;

不过要在根目录下要价格配置文件: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="index.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="***">
          <match url="/*"/>
          <action type="Rewrite" url="index.js"/>
        </rule>
      </rules>
    </rewrite>
    <iisnode loggingEnabled="false" logDirectory="iisnode" devErrorsEnabled="false" nodeProcessCommandLine=""%programfiles%\nodejs\node.exe"" interceptor=""%programfiles%\iisnode\interceptor.js""/>
  </system.webServer>

  <system.web>
    <compilation debug="true"/>
  </system.web>

</configuration>

  里面的url可以为你的启动文件app.js,这里index我们直接用的www文件改为了index.js,丢到了根目录下。

软件iisnode的版本:iisnode-full-v0.2.11-x86.msi。

posted @ 2015-11-28 15:35  garsonguo  阅读(1345)  评论(0编辑  收藏  举报