我正在尝试使用 https://0.0.0.0:9000
启动IP 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();
它允许我启动其他IP地址,如127.0.0.1:9000
,192.168.100.10:9000
等,但不是0.0.0.0:9000
。我已经读过这是一个有效的IP。但我的问题是为什么不允许这样做?此IP是否用于任何目的?
更新
这里唯一的目的是,我试图通过提供的公共IP访问内部IP。但是Nancy即使用端口启动内部IP,当通过公共IP提供请求时,它也无法识别。不确定这是否可以实现。
答案 0 :(得分:6)
我想出了:
public Event getByName(String name);