我该如何保护我的服务使用SSL的服务使用创建的服务堆栈?我的、堆栈、我该、SSL

2023-09-04 02:18:16 作者:趴在窗边数星星i

我想,以确保实现在服务栈我的REST服务,通过X509证书的手段?我将举办我的服务在.NET应用程序。

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.

使用证书的任何工作的例子将是非常美联社preciated。

Any working example using certificates would be highly appreciated.

推荐答案

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

I've been following these two examples:

的http://pfelix.word$p$pss.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:

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

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

设置我的端点地址为:https://开头*:443 /

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

从博客然的命令:

netsh的HTTP添加urlacl URL = https://开头+:443 /用户= XXX

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}

这失败,一个致命错误 - 1312,这的链接解释该问题的原因。该决议是对我们的网络家伙还算容易,但超出了我的证书的理解。

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.

在安装了正确的证书,netsh命令运行没有问题,我和使用SSL运行。

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