1

I tried every solutions, but none of them worked.
My nodejs website is hosted on windows IIS, with iisnode, everything was fine until today.
Also there is something instresting. Lets asume that my domain is cdn1.site.com that gets this error. I create new IIS website, with same physical path, but different domain name: cdn2.site.com
Same request get error on cdn1.site.com, but not on cdn2.site.com !!
What's the problem with first domain !?

Domains use SSL that creates with Let's Encrypt

Main part of 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>
MeTe-30
  • 2,512
  • 2
  • 21
  • 30
  • 1
    The same error here you can use as a reference: [https://stackoverflow.com/a/63675264/13336642](https://stackoverflow.com/a/63675264/13336642). – samwu Aug 24 '21 at 07:01

2 Answers2

0

It sounds a lot like this issue: https://github.com/tjanczuk/iisnode/issues/481

Add this right under configuration on your Web Configuration:

  <appSettings>
 <add key="NODE_PENDING_PIPE_INSTANCES" value="65535" />
</appSettings> 
Technoob1984
  • 172
  • 9
0

I had a monitoring page on cdn1.site.com/monitor , that execute readFileSync on about 250MB txt file every 5 sec.
I realized there were 2 open tabs with that route, and because of the heavy reading files process my other requests failed, and when I close those pages everything worked fines.
So that's the reason I had a problem on cdn1 not on cdn2
I didn't try the @Technoob1984 solution. I installed the latest iisnode version and looks like they increased the default value of NODE_PENDING_PIPE_INSTANCES in the latest version
But maybe a combination of our solutions solves someone's problem.

MeTe-30
  • 2,512
  • 2
  • 21
  • 30