Azure App Service uses IISNode to talk to node.exe processes. This happens over named pipes.
Configure your application to use the named pipe instead of a socket.
i.e.
Replace
app.set('port', 3000);
by
app.set('port', process.env.PORT || 3000);
Enable WebSockets in the Portal, restart the Web App and you should be up and running.
[ Gary Liu is right, that setting is not needed. However using a sample Socket.IO chat implementation on App Service, Socket.IO doesn't seem to care about how i set "WebSockets" in the portal. Works either way. ]
Since Internal Server Error is the computing equivalent to There is a fault in the observable Universe you should also enable logging for your Node application, at least for the development phase:
From https://azure.microsoft.com/en-us/documentation/articles/web-sites-nodejs-debug/:
To enable developer errors, add the following line to the IISNode.yml file:
devErrorsEnabled: true
Once this option is enabled, IISNode will return the last 64K of information sent to stderr instead of a friendly error such as "an internal server error occurred".
More on iisnode: http://www.jokecamp.com/blog/getting-started-with-iisnode/
More on named pipes: What are named pipes?