簡體   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