boost asio fail to bind port 80 - iis

My application is written in c++ thanks to boost asio library, with classical methods:
acceptor_.open(endpoint.protocol());
acceptor_.set_option(boost::asio::ip::tcp::no_delay(true));
acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
acceptor_.bind(endpoint);
acceptor_.listen();
On same machine, iis is running for a classic website.
I can't bind endpoint on port 80 in same time website is running. When i put a other port for binding, all is ok. It would be
Is there an issue for usin website and asio binding on same port?
Thanks for help me ...

IIS binds to port 80 by default. so that you cannot bind. If you want to bnd to port 80, stop IIS.

Related

How to link node+express server to domain

I have a domain name pointing to my vps IP. But when I run my express server I have to set a port, usually I use 3000, so the only way to get in my website is specifying the port: www.mysite.com:3000.
How can I make my app run in my domain without adding any port? My first guess was setting also the port in my domain name provider (111.11.11.11:3000) but Godaddy doesn't let me to add the port.
How can I make it work?
Newbie question, I know, but i'm a first timer and haven't found any answer to this.
The correct way is to change the port its hosted on. The default port for http traffic is 80, the one for https is 443. I assume you are on linux, if so you need to give some special permissions as ports below 1024 are privileged ports.
TLDR: if running http, change your express config to 80, if https 443
If using express, you need to change express port from 3000 to 80 if you plan using HTTP or 443 if you plan using HTTPS.
This is assuming your VPS does not already use port 80 or 443 while running an HTTP server like apache or nginx.
If you are in this case you will need to set up a reverse proxy.
I went for Nginx solution, I could make the port forward really easy following this guide:
https://eladnava.com/binding-nodejs-port-80-using-nginx/
For those who face this problem, solution is much more easier than it could look at beginning.

Run node js application without port

I wants to run my application without assigning any port on my current IP address on port 80. How it will possible.
If your node.js application is a web server, you cannot remove the port. No port, no web server. Trying to make a web server without a port is like trying to make a locomotive with no railroad.
You can use the default port however. When users give browsers URLs without ports, they automatically apply the default port. For URLs like http://example.com/ or http://10.11.12.13/ the default port is 80. For https://example.com it's 443, and you need to use the https server class.
So, you can make your server listen on port 80.
In development you will run into a problem with this approach. On OSX, Linux, and other UNIX-derived OSs, only the privileged (root) user can run servers that use port numbers less than 1024. The typical development cycle of edit / run / test is a huge hassle, and a security hole, when you need privileges to run. That's why the node.js examples use port 3000.
In production, many people use nginx as a reverse proxy server to relay http requests from port 80 or https requests from port 443 to your node.js server at port 3000. You can read about how to do that; it's far beyond the scope of a Stack Overflow answer,

80 port still running after stopped the site

In some windows machines, after stopped the IIS site which running in 80 port number, still that port number is in use. This issue randomly reproducing in few machines.
Is there a way to stop this port number using C#?
There is a difference between stopping a website and releasing a port.
IIS could have several sites listening to port 80, all with different host headers.
Stopping a site just means that request's aren't being handled. Try stopping the application pool.
But the ports are in use by the kernel (HTTP.sys) so no guarantee about releasing them.

Is it possible to bind port 443 to HTTP on IIS?

Is it possible to use port 443 on http?
I am adding a new binding as http on 443. There is no other bindings as well. But IIS can not be started. It says that another web site may be using the same port.
I use nestat. But I could not find a solution.
Thanks for your help?
I found a solution but I am not sure. There may be side effects.
I changed IP address of the binding in site bindings dialog box on IIS. Instead of all unassigned I used specific IP address.
"HTTPS URLs begin with "https://" and use port 443 by default, whereas HTTP URLs begin with "http://" and use port 80 by default." Source: Wikipedia, HTTP Secure/HTTPS. Port 443 is categorised as well-known port.
It's yet another limitation imposed by the IIS Manager GUI, you can bind to *:443 over HTTP using the appcmd.exe CLI tool!
Or as you found out, bind to just a single IP instead of all from the UI

Node.js port compatibility

I'm starting an app in node.js, using socket.io and it's on the same server that runs apache, so port 80 is unavailable. By default, it's using port 8080. I read on socket.io's site that port 843 is generally not blocked.
I understand this is also the port used for flash files. Is there reason not to use port 843? or likewise, not to use port 8080?
Also, would the ideal solution be to use a different server and run on port 80?
Is there reason not to use port 843? or likewise, not to use port 8080?
Yes, I know some offices block all ports but the common ones (80, 21, 25, etc). If you're just testing node, playing around, or even during development, then it doesn't matter.
Also, would the ideal solution be to use a different server and run on port 80?
Yep.
Just run on port 8080, especially if you only use socket.io and not the complete node.js stack. Makes no difference if you ask me.

Resources