Reputation: 932
I have this app.js code that makes calls on ports :3000
and :3001
http = require('http');
var express = require('express');
var app = express();
var server = http.createServer(app).listen(3001);
var io = require('socket.io').listen(server,{log:false, origins:'*:*'});
and at the bottom is
.listen(3000);
So for my web app in azure I don't think the :3001
is open correctly
On my local machine I can browse this folders assets on port localhost:3000
but to get to the /socket.io/socket.io.js
directory I have to use localhost:3001
This is part of the code's structure to perform the task we want.
I've ran through a lot of node & azure labs, but none of them are doing this particular setup, If I go to command prompt and run the app.js locally, my web app online works again, so I assume the port 3001 opens on my machine locally, while azure hosts 3000, I need some way to make the web app do both without running a VM, i'm not entirely sure what's all possible in azure web apps.
Upvotes: 2
Views: 580
Reputation: 13918
Windows Azure Websites uses IISNode to host the Node process inside of IIS. Your Node site is actually given a Named Pipe which receives the incoming requests, not a TCP port like you would use when running locally or hosting yourself. Even if you could open a TCP port, Azure Websites are really only meant for traditional websites and don't have a way to open ports to the outside world.
If you're looking for that type of control, you might want to look at VMs. They offer greater flexibility at the cost of you having to do more setup. With a VM you can open ports of your choosing.
In additional, you can leverage Cloud Service to satisfy your requirement. Here is a post about How to deploy multiple node apps in the same Azure instance for your reference.
Upvotes: 1