【问题标题】:How to host Node JS app on IIS 10 with Windows Server 2019如何使用 Windows Server 2019 在 IIS 10 上托管 Node JS 应用程序
【发布时间】:2020-07-25 20:01:26
【问题描述】:

我已经配置了 iisnode 所需的所有东西。但是当我通过http://localhost/Backend(后端是托管在 iis 上的站点名称)浏览网站时,什么都没有发生,页面继续加载。

我的 web.config:

    <?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
        <add name="iisnode" path="index.js" verb="*" modules="iisnode" />
    </handlers>
    <rewrite>
        <rules>
                <rule name="nodejs">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" pattern="" ignoreCase="true" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/index.js" />
                </rule>
        </rules>
    </rewrite>
    <security>
    <requestFiltering>
        <hiddenSegments>
            <add segment="node_modules" />
        <add segment="iisnode" />
        </hiddenSegments>
    </requestFiltering>
    </security>
    </system.webServer>
</configuration>

【问题讨论】:

  • 尝试通过预先设置将应用程序池 -> 空闲超时设置为“0”并检查确切的问题。确保您安装了 iisnode 模块。 forums.asp.net/t/…
  • 感谢您的回复。将空闲超时设置为“0”后,我发现了我的问题。实际上我的 web.config 重写规则没有指向我的节点 js 应用程序运行的确切位置。将此行 替换为 localhost:2146" /> 后,它工作正常。但我无法理解 iisnode 的用途。当我删除这一行 它也在工作。
  • 我发布了解决方案,请将其标记为答案,它将帮助面临类似问题的其他人。
  • 您是否在 Windows Server 2019 上为 IIS v10 安装了 IISNode?如果可以,请告诉我 IISNode 下载位置

标签: node.js windows iis-10 iisnode


【解决方案1】:

尝试通过预先设置将应用程序池 -> 空闲超时设置为“0”并检查确切的问题。确保您安装了 iisnode 模块。

iisnode 模块表示 index.js 文件是由 iisnode 模块处理的 node.js 应用程序。

链接:

https://forums.asp.net/t/2145697.aspx?deploy+nodejs+web+api+in+IIS+server

https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-11-21
    • 2021-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-12
    • 2020-03-04
    • 1970-01-01
    • 2022-08-16
    相关资源
    最近更新 更多