Windows Azure cloud service IIS sometimes returns 503 error

I'm developing node.js application for Azure Cloud services. Everything works great, BUT sometimes my application returns 503 error, when deployed on Azure, with no particular reason. I connected to the role VM via Remote Desktop, and found the following error in events list, corresponding to the time of the 503 code return:

A process serving application pool '6cd02903-1cba-4667-9d0b-20883ad3f0de' terminated unexpectedly. The process id was '2284'. The process exit code was '0xfffffffe'.

I tried to Google that error message, and it seems like IIS misconfiguration usually causes the problem, but it seems to be persistent in that case, not just sometimes like in my experience. Also I don't feel confident in changing IIS configuration on ready-made web roles servers provided by Azure. I've got feelings it has something to do with node, more probably iis-node issue.

Any help in debugging the problem will be greatly appreciated.

First of all this kind of crash reflect that your app domain crashed due to some exception in your web app. Such kind of problems are critical ones. Because you are using node.js it is very much possible that some of your code may be responsible for such problem however this issue needs to be investigated properly.

IF you turn off "Rapid Fail Protection" in your application pool, you could avoid the problem but not sure how long because if you have any issue with code anywhere it is best to solve the problem first rather then masking it.

As your exit code is 0xFFFFFFFE, which related to code CLEAN_WORKER_PROCESS_EXIT_CODE means the process was terminated clean as the crash was not abrupt/forced. What you can do is first RDP to you Azure VM ( I hope you have small or bigger size VM) and then Debug Diagnostics tools to investigate IIS crash issue. IF you can not troubleshoot this issue, you can contact Windows Azure Support team for free assistance and they will help you to trouble shoot this problem.