Я новичок в .NET и в SSL, и у меня возникла проблема с установлением безопасного обмена данными между службой SOAP и клиентом.Он работал нормально с HTTP, но теперь мы должны применить SSL.Мы получаем сертификат от CA.были сделаны следующие шаги:
1) включение порта, используемого службой с использованием httpcfg set ssl -i 0.0.0.0:777 -h <thumbprintkey>
2) httpcfg set urlacl -u <a href="https://<domanname>:777/TlsService/ServiceSecure" rel="nofollow">https://<domanname>:777/TlsService/ServiceSecure</a> -a D:(A;;GA;;;AN)
3) httpcfg set iplisten-i 0.0.0.0:777
Код WebService следующий:
WSHttpBinding binding = new WSHttpBinding();
binding.Security.Mode = SecurityMode.Transport;
binding.Security.Message.ClientCredentialType = MessageCredentialType.None;
ServiceHost host = new ServiceHost(typeof(DeviceObservationConsumer_hostPCDData), new Uri("https://<domainname>:777/TlsService/ServiceSecure"));
host.Credentials.ServiceCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindByThumbprint, (string)"bd 35 ec c0 e6 b3 9a ac 74 09 09 c5 84 b8 fd 58 51 44 87 7d");
host.AddServiceEndpoint(typeof(IDeviceObservationConsumer_Binding_Soap12), binding, "");
ServiceMetadataBehavior smb = host.Description.Behaviors.Find<ServiceMetadataBehavior>();
// If not, add one
if (smb == null)
smb = new ServiceMetadataBehavior();
smb.HttpsGetEnabled = true;
host.Description.Behaviors.Add(smb);
// Add MEX endpoint
host.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexHttpsBinding(), "mex");
host.Open();
Код клиента следующий:
WSHttpBinding binding = new WSHttpBinding();
binding.Security.Mode = SecurityMode.Transport;
binding.Security.Message.ClientCredentialType = MessageCredentialType.None;
EndpointAddress addr = new EndpointAddress("https://<domainname>:777/TlsService/ServiceSecure");
ChannelFactory<DeviceObservationConsumer_PortType> myChannelFactory = new ChannelFactory<DeviceObservationConsumer_PortType>(binding, addr);
//myChannelFactory.Credentials.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindByThumbprint, (string)"bd 35 ec c0 e6 b3 9a ac 74 09 09 c5 84 b8 fd 58 51 44 87 7d");
DeviceObservationConsumer_PortType client = myChannelFactory.CreateChannel();
CommunicatePCDDataRequest req = new CommunicatePCDDataRequest("ciao mamma guarda come mi diverto!");
CommunicatePCDDataResponse resp = client.CommunicatePCDData(req);
myChannelFactory.Close();
И служба, и клиент находятся на одном компьютере.
Я не могу получить доступ к https://<domanname>:777/TlsService/ServiceSecure
через браузер (ошибка страницы не найдена) и, конечно же, клиент не может получить к ней доступ.в чем может быть проблема, может кто-нибудь помочь мне !!!! ??
Заранее спасибо,
Людмила