获取Web服务C#的SSL证书

时间:2017-11-13 15:14:22

标签: c# web-services x509certificate

我创建了一个web服务,我从商店获得证书如下

 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;

            X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
            certStore.Open(OpenFlags.OpenExistingOnly & OpenFlags.ReadOnly);
            X509CertificateCollection clientCertificates = (X509CertificateCollection)certStore.Certificates;



            X509Certificate certificate = new X509Certificate();
            foreach (X509Certificate Cert in clientCertificates)
            {
                if (Cert.Issuer.Contains("O=Neutralus,"))
                {
                    certificate = Cert;
                }
            }

当我测试Web服务并为我获取证书时,这工作正常但是当我部署此服务并从其他计算机访问它时,它会给我以下错误

  

在SSL流中找不到客户端证书。客户端无法进行身份验证。

我在两台计算机上都安装了证书,并尝试了StoreLocation.LocalMachine和所有StoreName。

0 个答案:

没有答案