我想配置一个WCF服务器\客户端SSL工作HTTP请求与客户端身份验证方案“无名氏”禁止
我得到以下异常:
The HTTP request was forbidden with client authentication scheme 'Anonymous'
我有一个自我托管的WCF服务器。 我已经运行hhtpcfg 我的两个客户端和服务器证书存储的个人和信任的人在本地计算机上的
这里是服务器代码:
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
binding.Security.Mode = WebHttpSecurityMode.Transport;
_host.Credentials.ClientCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.PeerOrChainTrust;
_host.Credentials.ClientCertificate.Authentication.RevocationMode = X509RevocationMode.NoCheck;
_host.Credentials.ClientCertificate.Authentication.TrustedStoreLocation = StoreLocation.LocalMachine;
_host.Credentials.ServiceCertificate.SetCertificate("cn=ServerSide", StoreLocation.LocalMachine, StoreName.My);
客户端代码:
binding.Security.Mode = WebHttpSecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
WebChannelFactory<ITestClientForServer> cf =
new WebChannelFactory<ITestClientForServer>(binding, url2Bind);
cf.Credentials.ClientCertificate.SetCertificate("cn=ClientSide", StoreLocation.LocalMachine, StoreName.My);
ServicePointManager.ServerCertificateValidationCallback
+= RemoteCertificateValidate;
查看web_tracelog.svclog和trace.log 显示服务器无法验证客户端证书 我的证书未由授权人签名但这就是我将它们添加到可信人员的原因....
我在想什么? 我错过了什么?
第二个命令失败,错误:无法加载颁发者证书('MyCAPublic.cer') – TDaver 2011-06-20 14:45:40