【问题标题】:Why doesn't Nodejs app work on Windows IIS为什么 Nodejs 应用程序不能在 Windows IIS 上运行
【发布时间】:2015-04-23 22:43:36
【问题描述】:

我将 nodejs 应用程序与我想在 Windows IIS 上托管的 express 一起使用。在我的 IIS8 nodejs 上工作。但我收到一个错误“无法获取 /node/server.js”,我在 web.config 中放置了重写规则。然后我收到以下错误。

HTTP 错误 500.19 - 内部服务器错误 请求的页面无法访问,因为该页面的相关配置数据无效。

我在网上发现的。每个人都建议以下配置,但在我的 Windows 上不起作用

我的 web.config 文件是:

<configuration>
  <system.webServer>
<handlers>
  <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
</handlers>
<defaultDocument>
  <files>
    <add value="server.js" />
  </files>
</defaultDocument>
<rewrite>
  <rules>
    <rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
      <match url="^[a-zA-Z0-9_\-]+\.js\.logs\/\d+\.txt$"/>
    </rule>
    <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
      <match url="^server.js\/debug[\/]?" />
    </rule>
    <rule name="StaticContent">
      <action type="Rewrite" url="public{REQUEST_URI}"/>
    </rule>
    <rule name="DynamicContent">
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
      </conditions>
      <action type="Rewrite" url="server.js"/>
    </rule>
  </rules>
</rewrite>
<iisnode nodeProcessCountPerApplication="8" watchedFiles="*.js;node_modules\*;routes\*.js;views\*.html"/> 
</system.webServer> 
</configuration>

有什么建议吗? 谢谢

【问题讨论】:

    标签: node.js iisnode


    【解决方案1】:

    您的配置文件看起来有效。所以,你必须安装iis rewrite extension,它运行良好。

    【讨论】:

      猜你喜欢
      • 2021-09-19
      • 1970-01-01
      • 1970-01-01
      • 2019-12-19
      • 2023-03-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-22
      相关资源
      最近更新 更多