繁体   English   中英

为什么Nodejs应用程序不能在Windows IIS上运行

[英]Why doesn't Nodejs app work on Windows IIS

我使用带有express的nodejs应用程序我希望在Windows IIS上托管。 在我的IIS8 nodejs工作。 但我得到一个错误'无法获取/node/server.js',我在web.config中添加了重写规则。 然后我得到以下错误。

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

我在网上发现了。 每个人都建议以下配置,但不能在我的窗户上工作

我的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>

有什么建议吗? 谢谢

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM