我正在尝试使用服务器上的证书建立WCF连接,以验证服务器并加密客户端和服务器之间的数据。
我已经像这样配置了服务器端:
// 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();
允许服务打开。
但是,我尝试定义可以连接到此端的客户端失败了。
有人能让我朝着正确的方向前进吗?
亲切的问候,
MIC