【发布时间】:2015-02-17 15:45:36
【问题描述】:
我尝试在自托管模式下启动一个 nancyfx 网络服务器。 执行以下代码时一切正常:
public static void Main(string[] args)
{
var hostConfig = new HostConfiguration
{
UrlReservations = new UrlReservations
{
CreateAutomatically = true
},
};
var host = new NancyHost(hostConfig, new Uri("http://localhost:8081"));
host.Start();
Console.ReadLine();
host.Stop();
}
但是,当我将 uri 更改为 https://... 时,服务器会启动,但浏览器打开的每个连接都会立即关闭,并且浏览器会显示“网站不可用”。由于超时,连接甚至在浏览器关闭连接之前就关闭了。
我在 Windows 上使用 .NET 4.5 运行应用程序。使用 netstat -a 我可以知道打开了正确的端口。
我错过了什么吗? 感谢您的帮助。
【问题讨论】: