是否可以使用nancy启动主机0.0.0.0:port?

Gur*_*Rao 7 c# ip ip-address nancy

我正在尝试使用IP启动主机https://0.0.0.0:9000,Nancy Host但我遇到System - The request is not supported异常.以下是我的代码.

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();
Run Code Online (Sandbox Code Playgroud)

这将让我启动其他IP地址一样127.0.0.1:9000,192.168.100.10:9000等等,但不是0.0.0.0:9000.我已经读过这是一个有效的IP.但我的问题是为什么不允许这样做?此IP是否用于任何目的?

更新


这里唯一的目的是,我试图通过提供的公共IP访问内部IP.但是Nancy即使用端口启动内部IP,当通过公共IP提供请求时,它也无法识别.不确定这是否可以实现.

小智 7

我想出了如何:

HostConfiguration hostConf = new HostConfiguration();
hostConf.RewriteLocalhost = true;
var apiHost = new NancyHost(hostConf, new Uri("http://localhost:8080"));
apiHost.Start();
Run Code Online (Sandbox Code Playgroud)