I am running an express.js app, with iisnode as the handler.
Whenever I restart the site in IIS, or recycle the app pool (either manually or by saving the web config after changing a file) the app crashes with a 500.1001 error but only on the very first request. If the same route or any other route is requested thereafter, the app works fine.
I have this code in the index.js entry point
var server = app.listen(process.env.PORT, function () {
var host = server.address().address;
var port = server.address().port;
console.log('Example app listening at http://%s:%s', host, port);
});
which is logging undefined for host, port on the first request, but I have no idea why!
Detailed Error Information:
- Module iisnode
- Notification ExecuteRequestHandler
- Handler iisnode
- Error Code 0x00000002
- Requested URL (app entry point url)
- Physical Path (physical file path to app entry point)
- Logon Method Anonymous
- Logon User Anonymous