0
votes

I have a node.js web-role project targeted for Azure Cloud Services. Running the node.js project in plain node.exe works fine. Trying to run it on the emulator however does not work.

The Azure Cloud Service project referencing the node.js project builds and packages just fine, but the VM (and the azure compute emulator) shutdown almost immidiatly after launching. I can't even manage to open the azure emulator UI to see what's going on due to this.

I am working with full IIS 7.5 and have installed iisnode 0.2.18 from GitHub. Using VS 2013 Ultimate and Azure SDK 2.6 all under Win7 x64.

The project is configured to use full IIS of course. I should mention that it seems to me the setup_web.cmd batch file under the project's bin directory is quite irrelevant. Checking its output log reveals that it is looking for non-existent things such as the config file from the APPCMD macro, and a folder name iisnode-dev (iisnode installed itself in C:\Program Files\iisnode). However, tweaking with the setup_web.cmd and ChangeConfig.ps1 did not help (at least not my tweaks..)

There are no errors on the Windows Azure event log on my machine. Only Information messages about the roles being initialized and the scripts being run so no help there.

I know that iisnode is installed correctly since I setup the bundled samples and they all work right off localhost.

Any help is appreciated.

1
Have you enabled RDP on the role and tried looking for event logs on the server?Jeremy Foster
There is not enough time to do that. The instances shutdown almost immediately after spawning.stav
Aha. Try my answer below. Hope it helps. I've been stuck there before.Jeremy Foster

1 Answers

0
votes

I suggest you attempt to remote debug. You still have a bit of a race condition, because you have to have the service up in order to connect to it with the remote debug scenario. You should be able to put a wait statement in the node file before you spin up any services (perhaps before a listen statement). Here's a wait function you can use...

wait(30);
...
function wait(seconds) {
    var start = new Date().getTime();
    var delay = seconds * 1000;
    while (new Date().getTime() < start + delay);
}