Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a nodeJS sites in Azure Websites

I'm trying to run a nodeJS site in Windows Azure websites. I just git pushed two files:

server.js package.json

And all of my modules from npm install. It works fine locally but when I browse the WA Website I just get:

The page cannot be displayed because an internal server error has occurred.

I used the CLI to get the tail logs but I just see this:

<h3>HTTP Error 500.0 - Internal Server Error</h3> 
<h4>The page cannot be displayed because an internal server error has occurred.</h4> 
</div> 
<div class="content-container"> 
<fieldset><h4>Most likely causes:</h4> 
<ul>    <li>IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.</li>    <li>IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.</li>    <li>IIS was not able to process configuration for the Web site or application.</li>     <li>The authenticated user does not have permission to use this DLL.</li>   <li>The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.</li> </ul> 
</fieldset> 
</div> 
<div class="content-container"> 
<fieldset><h4>Things you can try:</h4> 
<ul>    <li>Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.</li>     <li>Check the event logs to see if any additional information was logged.</li>  <li>Verify the permissions for the DLL.</li>    <li>Install the .NET Extensibility feature if the request is mapped to a managed handler.</li>  <li>Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul> 
like image 549
ConfusedNoob Avatar asked Jun 13 '13 05:06

ConfusedNoob


1 Answers

Without seeing your actual server.js code (which you should insert into your question), I can only guess at what could be the issue. So... my guess is that your server.js isn't listening on the right port (of course, I could be wrong...).

In the the node.js tutorial on the WindowsAzure.com site in the node.js developer section, there's a "Hello World" example that shows how you need to grab the port from the environment:

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);

You can't just have your server listen on port 80. You need to grab the right port from process.env.PORT.

Hopefully this was your issue...

like image 114
David Makogon Avatar answered Oct 06 '22 10:10

David Makogon