Configure a Port with an SSL Certificate w\o using Httpcfg

☆樱花仙子☆ 提交于 2019-12-08 03:57:52

问题


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 :)


回答1:


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.




回答2:


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.




回答3:


Таке а look on https://github.com/segor/SslCertBinding.Net It also has nuget available

 Install-Package SslCertBinding.Net

and does what you need perfectly. Thanks to the author.



来源:https://stackoverflow.com/questions/3020416/configure-a-port-with-an-ssl-certificate-w-o-using-httpcfg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!