3

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.

4

1 回答 1

2

我一直在关注这两个例子:

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

在这两个博客中,我做了以下事情:

  1. 获得证书并安装在本地计算机>个人>证书

  2. 将我的端点地址设置为:https://*:443/

  3. 运行博客中的命令:

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

后来我发现这不起作用,这确实

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

然后链接证书:

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

这失败并出现致命错误 - 1312,此链接解释了问题的原因。对于我们的网络人员来说,解决方案相当容易,但超出了我对证书的理解。

一旦安装了正确的证书,netsh 命令就可以毫无问题地运行,并且我可以使用 SSL 启动并运行。

于 2013-01-15T11:43:16.167 回答