How do I secure my service using SSL for Services created using Service stack?

Deadly 提交于 2019-12-05 02:51:16

问题


I would like to secure my REST service implemented over the Service Stack, by means of X509 certificates? I will be hosting my service in a .NET application.

I can build the service and it seems to work fine.

Any working example using certificates would be highly appreciated.


回答1:


I've been following these two examples:

http://pfelix.wordpress.com/2012/02/26/enabling-https-with-self-hosted-asp-net-web-api/

http://blogs.msdn.com/b/jpsanders/archive/2009/09/29/walkthrough-using-httplistener-as-an-ssl-simple-server.aspx

From the two blogs I did the following:

  1. Obtained a cert and installed in the Local Computer > Personal > Certificates

  2. Set my Endpoint address to be: https://*:443/

  3. Ran the commands from the blogs:

    netsh http add urlacl url=https://+:443/ user=XXX

I later found that this didn't work and this did

 netsh http add urlacl url=https://*:443/ user=XXX

Then linked the certificate:

netsh http add sslcert ipport=0.0.0.0:443 certhash=XXXX appid={XXX}

This failed with a Fatal Error - 1312, this link explains the cause of the problem. The resolution was fairly easy for our network guy, but beyond my understanding of certs.

Once the correct cert was installed, the netsh command ran without a problem and I was up and running with SSL.



来源:https://stackoverflow.com/questions/14316804/how-do-i-secure-my-service-using-ssl-for-services-created-using-service-stack

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