J'essaie de configurer une connexion WCF en utilisant un certificat sur le serveur pour authentifier le serveur et crypter les données entre le client et le serveur.Comment créer une connexion WCF net.tcp qui se comporte comme une session HTTPS anonyme?
J'ai configuré la fin du serveur comme ceci:
// Create the Service serviceHost = new ServiceHost(typeof(CIncommingWCFObject)); // Now Create the Binding NetTcpBinding tcpb = new NetTcpBinding(); // Set the Security to use a certificate for both enctyption and signing... tcpb.Security.Mode = SecurityMode.TransportWithMessageCredential; tcpb.Security.Message.ClientCredentialType = MessageCredentialType.Certificate; tcpb.Security.Transport.ClientCredentialType = TcpClientCredentialType.None; tcpb.Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign; serviceHost.AddServiceEndpoint(typeof(IDatabaseServer), tcpb, Params.Uri); // Define the Servers Certificate serviceHost.Credentials.ServiceCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindBySubjectName, Params.CertificateName); // And then open the socket... serviceHost.Open();
qui ne permet le Service à ouvrir.
Cependant, mes tentatives pour définir l'extrémité du client qui peut se connecter à cela ont échoué.
Quelqu'un peut-il me mettre dans la bonne direction?
Cordialement,
Mic