为什么我的IIS托管Web服务中没有收到客户端证书?

时间:2014-11-28 17:07:36

标签: web-services iis ssl-certificate

我有一个asmx网络服务,我正在尝试验证客户端证书:

var cert = Context.Request.ClientCertificate.Certificate;
if (cert == null || cert.Length == 0)
{
    throw new ArgumentException("certificate can not be found");
}

我的测试代码在控制台应用程序中是这样的:

ServiceReference1.PortfolioImportSoapClient import = new ServiceReference1.PortfolioImportSoapClient();
X509Certificate2 x509 = new X509Certificate2(@"D:\zurichpdf\publickey.cer");
import.ClientCredentials.ClientCertificate.Certificate = x509;
var model = new ServiceReference1.PortfolioMessageModel();
model.ClientID = 1;
import.ImportTransactionPortfolio(model);

我可以看到,从控制台应用程序中,包含了客户端证书。但在服务器端,Context.Request.ClientCertificate.Certificate为空。

我检查了配置文件,它有类似的内容:

  <basicHttpBinding>
    <binding name="PortfolioImportSoap" >
    </binding>
  </basicHttpBinding>

有人能告诉我为什么x509证书没有传递给我的asmx网络服务吗?我也应该在这里设置一些安全模式吗?

非常感谢

0 个答案:

没有答案
相关问题