2012-05-24 5 views
1

인증서를 사용하여 메시지 보안을 구현 한 WCF 서비스가 있습니다. 그러나 클라이언트 응용 프로그램에서 WCF 서비스에 연결하려고하면 다음 오류가 발생합니다.인증서 인증을 사용하는 WCF의 메시지 보안 문제

호출자가 서비스에서 인증되지 않았습니다.

내 구성 설정은 다음과 같습니다 :

서비스 설정 :

ServiceHost host = new ServiceHost(typeof(HostService)); 
NetTcpBinding tcpBinding = new NetTcpBinding(SecurityMode.Message); 
tcpBinding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate; 
host.AddServiceEndpoint(typeof(IHostService), tcpBinding, "net.tcp://192.168.39.28:8000/HostService"); 
host.Credentials.ServiceCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindBySubjectName, "server_cert"); 

클라이언트 설정 :

내가 makecert 명령을 사용하여 server_cert 및 client_cert 인증서를 만든
NetTcpBinding tcpBinding = new NetTcpBinding(SecurityMode.Message); 
tcpBinding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate; 
DuplexChannelFactory<IHostService> serviceFactory = new DuplexChannelFactory<IHostService>(new InstanceContext(MainWindow), tcpBinding, "net.tcp://192.168.39.28:8000/HostService"); 
serviceFactory.Credentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindBySubjectName, "client_cert"); 
serviceFactory.CreateChannel(); 

. 내가 놓친 걸 안내 해줄 수 있니?

답변

0

디버깅 인증서 관련 문제는 큰 고통이며, 나는 wireshark를 사용하는 것이 좋습니다. 귀하의 경우에는 클라이언트 측에서 인증서를 발송하지 않았을 수도 있습니다. 클라이언트 인증서가 다른 인증서로 서명 된 경우 클라이언트와 서버의 신뢰할 수있는 루트에 해당 인증서를 넣었는지 확인하십시오.

+0

클라이언트와 서버 모두에서 인증서를 신뢰할 수있는 루트에 저장하는 방법. 신뢰할 수있는 루트가 의미하는 바는 무엇입니까? 그것은 모든 폴더 위치입니까? 특별한 방법으로 인증서를 신뢰할 수있는 루트에 넣거나 인증서를 수동으로 복사 할 수 있습니까? – Thomas

+0

@SeaChange : 다음 링크에서이 문제에 대한 해결책을 얻었습니다. http://msdn.microsoft.com/en-us/library/ff647171.aspx 저장소에 인증서를 만들고 설치하는 모든 단계에 대해 설명했습니다. –

관련 문제