Reputation: 5347
I've followed this tutorial (https://www.windowsazure.com/en-us/develop/nodejs/tutorials/create-a-website-(mac)/) to the letter but I'm not getting the response I expect from my node server.
It works when I run node locally but once deployed to Azure I get this error:
iisnode encountered an error when processing the request.
HRESULT: 0xb HTTP status: 500 HTTP reason: Internal Server Error
This is my server.js:
var http = require( "http" );
http.createServer(function ( req, res ) {
res.writeHead( { "Content-Type": "text/plain"} );
res.end( "Hello Azure!\n" );
} ).listen( process.env.port );
Upvotes: 1
Views: 6913
Reputation: 16613
I just tried the exact same steps myself of the tutorial and was able to get the Hello world
message. This is my deployment at the moment: http://nodetestordinacc.azurewebsites.net/ (Note, I'll likely remove it in the future).
If it all runs locally then you should be able to follow the steps like I did from the tutorial and get it running successfully.
Can you verify the steps:
The [URL for remote repository] must be replaced with the url the portal provided in the beginning of the tutorial:
Update:
This is the code I used. Please copy it over exactly:
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);
Upvotes: 5