我想编写一个应该使用 https 的 WCF 服务(自托管)。 通过搜索网络,我发现了一篇来自 msdn 的博客文章告诉我 使用“netsh.exe”命令将证书绑定(bind)到端点 通过命令行: http://blogs.msdn.com/b/james_osbornes_blog/archive/2010/12/10/selfhosting-a-wcf-service-over-https.aspx
然而,这仍然是最先进的吗? 为什么不使用这个: http://msdn.microsoft.com/de-de/library/system.servicemodel.description.servicecredentials.servicecertificate(v=vs.100).aspx
还是我错过了什么? 感谢您的帮助。
最佳答案
所以我终于找到了为什么需要使用netsh命令:
查看这篇文章: https://msdn.microsoft.com/en-us/library/ms789011%28v=vs.110%29.aspx
From this article: If the transport is HTTP (using the WSHttpBinding), SSL over HTTP provides the transport-level security. In that case, you must configure the computer hosting the service with an SSL certificate bound to a port, as shown later in this topic. If the transport is TCP (using the NetTcpBinding), by default the transport-level security provided is Windows security, or SSL over TCP. When using SSL over TCP, you must specify the certificate using the SetCertificate method, as shown later in this topic.
所以只能使用tcp绑定(bind)的Property。 如果使用 ssl over http,则需要通过 netsh 命令将证书绑定(bind)到端口
关于wcf - 通过 Https 自托管 WCF 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24158884/