我想配置一個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