1

I've been trying Node.js running in Windows Azure Emulator, but unfortunatelly it isn't working. Of course, I started from beginning, Hello World application, following steps in this tutorial.

I followed the steps below with 4 different computers and in all cases the page didn't show anything.

  • I opened Windows PowerShell environment as Administrator.
  • I created node directory
  • I entered the command: PS C:\node> New-AzureService tasklist
  • I entered the command: PS C:\node\tasklist> Add-AzureNodeWebRole

Here, my application was created with the code above:

var http = require('http');
var port = process.env.port || 1337;
http.createServer(function (req, res) {
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    res.end('Hello World\n');
}).listen(port);
  • And finally, I entered the command: PS C:\node\tasklist\WebRole1> Start-AzureEmulator -launch

Now I was supposed to see my hello world page. The question is, if somebody had success with the given tutorial? And what Am I doing wrong?

3 Answers 3

4

I had your exact same error and looking for a long time on the Internet I found this post.

Just to summarize, the problem is that there's a script inside Node package for Azure that's trying to grant permissions for "Network Service" to the web root directory. However my system language is it-IT, so I don't have a user called "Network Service".

So you need to edit the script. If your application path is C:\node\tasklist then the script is located at

C:\node\tasklist\local_package.csx\roles\WebRole1\approot\bin\setup_web.cmd

Just change this line:

icacls ..\ /grant "Network Service":(OI)(CI)W

with this:

icacls ..\ /grant "NetworkService":(OI)(CI)W

This worked for me!

Sign up to request clarification or add additional context in comments.

5 Comments

That is a miracle! It worked like a charm! How come a silly blank space make me lose so much to time? :( Thank you so much!
I thought exactly the same... Just FYI, that file is generated from a scaffolding file located at C:\Program Files (x86)\Microsoft SDKs\Windows Azure\Nodejs\Nov2011\PowerShell\Scaffolding\Node\WebRole\bin\setup_web.cmd You should edit that file, or you'll have to modify every new package you make in the future.
Nice trick! In fact, I stopped trying to use azure emulator since (I was not able to do it and) I met Cloud9! But it helps a lot! Thank you to waste your time with my doubt!
Has someone filed a bug for this over at github.com/WindowsAzure/azure-sdk-for-node?
I just did. Hope someone will fix that soon.
1

You can try running the example directly in node using:

node server.js

and pointing a browser to http://localhost:1337. This takes the Windows Azure emulator out of the picture and might indicate if there is something else going on.

3 Comments

Hi Neil! Thank you for the help, I did what you said and I saw my application running. But I would like to see it working in Windows Azure Emulator. That's the point! Anyway thank you!
I successfully ran the example as described above. The Windows Azure support for node.js is implemented completely differently in worker roles and web roles. Since it ran successfully using the node.exe command line it should run successfully in a worker role since that just launches node.exe. I would try the example above using a worker role instead of a web role. If this also fails you might want to try a clean install of both the Windows Azure SDK v1.6 and Windows Azure for Node.js.
Did you run exactly as I said? I can't understand what I'm doing wrong! I just format my computer to try it again. I did all steps before install anything but Azure for Node.js through Web Installer API. Are you using the emulator released last Friday?
0

I think your case is similar with below article. http://blogs.msdn.com/b/avkashchauhan/archive/2012/01/31/handling-two-known-issues-with-windows-azure-node-js-sdk-0-5-2.aspx

I hope you can solve the problem by this info.

1 Comment

Hey Normalian! It didn't work for me! I think the reason is because I have a different version of the article here. The version here is 0.5.3 and the article helps a problem of 0.5.2 version. Thank you for help me!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.