如何使用 Windows Server 2019 在 IIS 10 上托管 Node JS 应用程序 [英] How to host Node JS app on IIS 10 with Windows Server 2019

查看:33
本文介绍了如何使用 Windows Server 2019 在 IIS 10 上托管 Node JS 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have configured all those things which are necessary for iisnode. But when i browse the site through http://localhost/Backend (Backend is a site name hosted on iis) then nothing is being happened and page keeps loading.

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

推荐答案

尝试通过预先设置将 Application Pools-> Idle Time-Out 设置为0"并检查确切的问题.确保您安装了 iisnode 模块.

Try to set the Application Pools-> Idle Time-Out to "0" by advance setting and check what is the exact issue. make sure you installed the iisnode module.

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

iisnode module indicates that the index.js file is a node.js application to be handled by the iisnode module.

链接:

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

这篇关于如何使用 Windows Server 2019 在 IIS 10 上托管 Node JS 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆