iisnode
iisnode copied to clipboard
How to make iisnode wait for listen
We're having an issue where iisnode is taking requests after node has started but before our application is listening. Because of this, there's a small period of time where iis returns 500's because the app hasn't fully initialized.
Is there a way to resolve this?
Try increasing the value of maxNamedPipeConnectionRetry and/or namedPipeConnectionRetryDelay.
When a first HTTP request arrives that targets a particular Node.js application, iisnode will lazily create a node.exe process for that application. While the process is initializing and before it actually starts listening, IIS/iisnode will queue up any subsequent HTTP requests that target it. The way iisnode knows the node.exe is ready to accept HTTP requests is by periodically probing whether the listener is responsive. This probing behavior is controlled by namedPipeConnectionRetryDelay and maxNamedPipeConnectionRetry. If iisnode is unable to establish communication with node.exe after maxNamedPipeConnectionRetry, it will respond to all queued up HTTP requests with HTTP 500. The default values for these two settings work in most situations, but may need to be modified when the initialization logic of a node.js application is particularly heavy (which is sometimes the case with Express apps that compile views on initialization), or on particularly loaded servers.
If you control your server, you can also try to use application initialization to always keep the Node.js application running instead of relying on message-based activation.
@tjanczuk is this also possible with IIS 7 ? I'm having the exact same issue but I'm running IIS 7 and would like to switch from message-base-activation.
I have same problem too, there is any solution yet ? Thanks