2010-02-23 6 views
0

서버를 인증하고 클라이언트와 서버 간의 데이터를 암호화하기 위해 서버의 인증서를 사용하여 WCF 연결을 설정하려고합니다. 나는이 같은 서버 종료를 구성익명 HTTPS 세션처럼 동작하는 WCF net.tcp 연결을 만드는 방법은 무엇입니까?

: 서비스가 열 수 않습니다

 
    // 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(); 

.

그러나 연결할 수있는 클라이언트 쪽을 정의하려는 시도가 실패했습니다.

누구나 올바른 방향으로 나를 설정할 수 있습니까?

종류와 관련,이 문서가 도움이 될 수

답변

관련 문제