BasicHttpBinding avec l'authentification par Certificat d'erreur “interdit”?

Je vais essayer d'aller récupérer WCF serveur et client de s'authentifier mutuellement les uns des autres à l'aide de certificats SSL sur le transport de niveau à l'aide de BasicHttpBinding. Voici comment le serveur est arriver créé:

var soapBinding = new BasicHttpBinding() { Namespace = "http://test.com" };
soapBinding.Security.Mode = BasicHttpSecurityMode.Transport;
soapBinding.Security.Transport.ClientCredentialType =
    HttpClientCredentialType.Certificate;
var sh = new ServiceHost(typeof(Service1), uri);
sh.AddServiceEndpoint(typeof(IService1), soapBinding, "");
sh.Credentials.ServiceCertificate.SetCertificate(
    StoreLocation.LocalMachine, StoreName.My, 
    X509FindType.FindBySubjectName, "localhost");
sh.Open();

Voici le client:

var binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.Transport;
var service = new ServiceReference2.Service1Client(binding,
    new EndpointAddress("https://localhost:801/Service1"));

service.ClientCredentials.ClientCertificate.SetCertificate(
    StoreLocation.LocalMachine, StoreName.My, 
    X509FindType.FindBySubjectName, "localhost");

service.ClientCredentials.ServiceCertificate.Authentication.
    CertificateValidationMode =
        System.ServiceModel.Security.X509CertificateValidationMode.PeerTrust;

service.HelloWorld();

Certificat pour localhost est Personnelle, Racine de Confiance et de Confiance 3ème Partie de conteneurs. Internet Explorer peut se connecter à l'hôte et voir le WSDL. Aussi, SSL appels fonctionnent très bien avec ClientCredentialType = HttpClientCredentialType.Aucun

HelloWorld() échoue avec:

System.ServiceModel.Security.MessageSecurityException occurred<br/>
  Message="The HTTP request was forbidden with client authentication
  scheme 'Anonymous'."

qui est un relancés exception de: "Le serveur distant a retourné une erreur: (403) Interdit".

comment fait-on autour de déterminer wtf qui se passe?

InformationsquelleAutor galets | 2009-04-08