Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to start host 0.0.0.0:port with nancy?

I am trying to start host with IP https://0.0.0.0:9000 with Nancy Host but am getting System - The request is not supported exception. Below is my code.

string strHostProtocol = "https";
string strHostIP = "0.0.0.0";
string strHostPort = "9000";

var url = strHostProtocol + "://" + strHostIP + ":" + strHostPort;
this.host = new NancyHost(new Uri(url));
this.host.Start();

It will allow me to start other IP address like 127.0.0.1:9000, 192.168.100.10:9000 etc., but not 0.0.0.0:9000. I've read that this is a valid IP. But my question is why this is not allowed to start? Is this IP reserved for any purpose?

Update


The sole purpose here is, I am trying to access a internal IP through a public IP provided. But Nancy even though starts internal IP with port, when request is provided through public IP, it will not recognize. Not sure whether this is achievable or not.

like image 465
Guruprasad J Rao Avatar asked Apr 15 '16 10:04

Guruprasad J Rao


1 Answers

I figured out how:

HostConfiguration hostConf = new HostConfiguration();
hostConf.RewriteLocalhost = true;
var apiHost = new NancyHost(hostConf, new Uri("http://localhost:8080"));
apiHost.Start();
like image 172
Wendal Chen Avatar answered Sep 28 '22 08:09

Wendal Chen