【问题标题】:iisnode - HRESULT: 0x6d - status: 500 - subStatus: 1013iisnode - HRESULT:0x6d - 状态:500 - subStatus:1013
【发布时间】:2021-08-23 17:57:58
【问题描述】:

我尝试了所有解决方案,但都没有奏效。
我的nodejs网站托管在windows IIS上,使用iisnode,直到今天一切都很好。
还有一点很有意思。假设我的域是出现此错误的 cdn1.site.com。我创建了新的 IIS 网站,物理路径相同,但域名不同:cdn2.site.com
同样的请求在 cdn1.site.com 上出现错误,但在 cdn2.site.com 上却没有!!
第一个域有什么问题!?

Domains use SSL that creates with Let's Encrypt

server.js 的主要部分:

var app = express();

const server = http.createServer(app);


function shouldCompress (req, res) {
    if (req.headers['x-no-compression']) {
        return false
    }
    return compression.filter(req, res)
}
app.use(compression({filter: shouldCompress}))

app.use(requestIp.mw());
app.use(helmet());
app.use(express.json({limit: '50mb'}));
app.use(express.text({limit: '50mb'}));
app.use(express.urlencoded({limit: '50mb', extended: true}));
app.use(cookieParser());

server.listen(process.env.PORT || 2000);

Web.config:

<configuration>                                                                                                                                                             
    <system.webServer>    
        <httpProtocol>    
            <customHeaders>                      
                <add name="Access-Control-Allow-Origin" value="*" />
                <add name="Access-Control-Allow-Methods" value="GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS" />
                <add name="Access-Control-Allow-Headers" value="Origin, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, X-Response-Time, X-PINGOTHER, X-CSRF-Token, csrfToken, $mt-oot-ti-kcuf, $mt-ti-kcu" />
            </customHeaders>
        </httpProtocol>
        <iisnode enableXFF="true" nodeProcessCommandLine="C:\Program Files\nodejs\node.exe  --trace-deprecation" />
        <httpErrors existingResponse="PassThrough" />
        <handlers>
            <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
        </handlers> 
        <rewrite>                     
            <rules>   
                <rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">  
                    <match url="iisnode" />  
                </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>
        <urlCompression doStaticCompression="true" doDynamicCompression="true" />  
  </system.webServer>
</configuration>

【问题讨论】:

标签: javascript node.js express iis iisnode


【解决方案1】:

听起来很像这个问题: https://github.com/tjanczuk/iisnode/issues/481

在您的 Web 配置的配置下添加此权限:

  <appSettings>
 <add key="NODE_PENDING_PIPE_INSTANCES" value="65535" />
</appSettings> 

【讨论】:

    【解决方案2】:

    我在 cdn1.site.com/monitor 上有一个监控页面,每 5 秒对大约 250MB 的 txt 文件执行 readFileSync
    我意识到该路线有 2 个打开的选项卡,并且由于读取文件繁重,我的其他请求失败了,当我关闭这些页面时,一切正常。
    所以这就是我在cdn1 上遇到问题而不是在cdn2 上遇到问题的原因
    我没有尝试@Technoob1984 解决方案。我安装了最新的 iisnode 版本,看起来他们在最新版本中增加了 NODE_PENDING_PIPE_INSTANCES 的默认值
    但也许我们的解决方案组合可以解决某人的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-03
      • 1970-01-01
      • 2015-10-20
      • 1970-01-01
      • 1970-01-01
      • 2011-01-01
      • 2014-01-08
      • 1970-01-01
      相关资源
      最近更新 更多