【发布时间】:2015-04-14 13:23:09
【问题描述】:
我正在开发一个 ASP.NET Web API 项目。 Web API 使用 OWIN 自托管。 OWIN 自主机作为 Windows 服务运行。大多数 Web API 的控制器都需要 HTTPS,我有一个用于 Web API 服务的小型配置程序,它成功地在本地机器存储中创建了一个自签名 SSL 证书,并使用 netsh 将其绑定到 Web API 的端口。然后我可以通过 HTTPS 成功连接到 Web API。简而言之,一切都按预期工作......直到我重新启动机器。
重启后,虽然我已经验证了证书和绑定仍然存在,但我无法再通过 HTTPS 访问服务,只收到 502 错误。例如,Fiddler 报告:
HTTP/1.1 502 Fiddler - Connection Failed
Date: Fri, 13 Feb 2015 09:27:28 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Cache-Control: no-cache, must-revalidate
Timestamp: 10:27:28.571
[Fiddler] The connection to 'host.example.com' failed. <br /> System.Security.SecurityException Failed to negotiate HTTPS connection with server.fiddler.network.https> HTTPS handshake to host.example.com failed. System.IO.IOException Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. < An existing connection was forcibly closed by the remote host
似乎 SSL 绑定丢失了。我发现了一些关于类似问题的问题,例如IIS loses HTTPS Endpoitn certificate after computer restart,但它们与 IIS 有关,据我所知,在我的情况下,它根本没有出现,因为自托管 Web API 在后台使用 WCF .
我目前完全没有想法,任何帮助将不胜感激。
【问题讨论】:
标签: c# ssl asp.net-web-api asp.net-web-api2 netsh