使用 SSL 证书配置端口,无需使用 Httpcfg
当开发一个自托管的 WCF http 服务器时, 所需步骤之一是将 SSL 证书绑定到端口号: httpcfg 设置 ssl -i 0.0.0.0:8012 -h 0000000000003ed9cd0c315bbb6dc1c08da5e6 如: http://msdn.microsoft.com/en-us/library/ms733791。然而
, 很难想象在我的部署环境中能够做到这一点。 (我什至不知道 httpcfg.exe 是否可重新分发) 此外,如果用户在安装产品后更改了端口,那么他将需要再次运行该命令...
如何在语法上自动执行此步骤?
最好使用 C#,但如果它只能用 C++ 完成(直接访问 Http Server API) 然后我会处理:)
When one develops a self-hosted WCF http server,
one of the steps needed is to bind an SSL certificate to a port number:
httpcfg set ssl -i 0.0.0.0:8012 -h 0000000000003ed9cd0c315bbb6dc1c08da5e6
as stated in:
http://msdn.microsoft.com/en-us/library/ms733791.aspx
However,
It is hardly expected that in my deployment environment one would be able to do it.
(I don't even know if the httpcfg.exe is redistributable)
Moreover, if the user changed the port after he installed the product then he will need to run the command again....
how can this step be automated pro grammatically?
preferably in C# but if it can only be done in C++ (direct access to the Http Server API)
then I will manage :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看看此处:用于配置直接驱动的 HTTP.SYS 的开源 C# UI API。这应该让您了解配置证书所需的代码。
Have a look here: an open source C# UI for configuring HTTP.SYS that directly drives the API. This should get you an idea of the code necessary for configuring the certs.
对于几年后进行调整的人:
这篇文章来自 Mike Bouck 的 RAM 的 有一个针对 http.sys api 的干净的 C# 包装器。
For those tuning in a couple of years later:
This article from Mike Bouck's RAM has a clean C# wrapper for the http.sys api.
请查看 https://github.com/segor/SslCertBinding.Net
它还具有可用的 nuget
,可以完美地满足您的需求。感谢作者。
Таке а look on https://github.com/segor/SslCertBinding.Net
It also has nuget available
and does what you need perfectly. Thanks to the author.