wcf и сертификаты
От: lrufus  
Дата: 10.05.08 13:17
Оценка:
Добрый всем день!
Пытаюсь сделать следующее:
Шифрование потока клиент-сервер, передача по https.
Использую WCF.
Сделал так.
Код сервера:

WSHttpBinding newSecBinding = new WSHttpBinding();
newSecBinding.Security.Mode = SecurityMode.Transport;
newSecBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; 
Type contractType = typeof(IService);
Type serviceType = typeof(Service);
Uri baseAddress = new Uri("https://localhost:9001/SimpleService/");
ServiceHost svcHost = new ServiceHost(serviceType, baseAddress);
newSecBinding.MaxReceivedMessageSize = 1000000000; svcHost.AddServiceEndpoint(contractType, newSecBinding, "https://localhost:9001/SimpleService/");
svcHost.Open();


Клиент:

WSHttpBinding newSecBinding = new WSHttpBinding();
newSecBinding.Security.Mode = SecurityMode.Transport; newSecBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
newSecBinding.MaxReceivedMessageSize = 1000000000;
ChannelFactory factory = new ChannelFactory(newSecBinding);
IService remoteObject = factory.CreateChannel(new EndpointAddress("Https://localhost:9001/SimpleService/"));


Далее, создал сертификат с помощью makecert. привязал сертификат на этот порт в качестве ssl с помощью httpcfg.
и ввел сертификат в доверенные корневые центры сертификации.
При запуске сервер создается корректно, а вот при коннекте к нему клиента выдается ошибка:
"An error occurred while making the HTTP request to https://127.0.0.1:9001/SimpleService/. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server."
Не могу понять в чем дело, буду очень благодарен за помощь.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.