title: Https web service in .NET problem
body: <p>i'm new in .NET and in SSL and i'm facing the problem with establishing the secure communication between the SOAP service and the client.
  It was working fine with HTTP but now we have to apply the SSL.
  We get the certificate from a CA.
  next steps weres done are following:</p>
  
  <p>1) enabling port used by the service using the <code>httpcfg set ssl -i 0.0.0.0:777 -h &lt;thumbprintkey&gt;</code></p>
  
  <p>2) <code>httpcfg set urlacl -u <a href="https://&lt;domanname&gt;:777/TlsService/ServiceSecure" rel="nofollow">https://&lt;domanname&gt;:777/TlsService/ServiceSecure</a> -a D:(A;;GA;;;AN)</code></p>
  
  <p>3)<code>httpcfg set iplisten-i 0.0.0.0:777</code></p>
  
  <p>The WebService code is following:</p>
  
  <pre><code>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://&lt;domainname&gt;: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&lt;ServiceMetadataBehavior&gt;();
  // 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();
  </code></pre>
  
  <p>The client code is following:</p>
  
  <pre><code>WSHttpBinding binding = new WSHttpBinding();
  binding.Security.Mode = SecurityMode.Transport;
  binding.Security.Message.ClientCredentialType = MessageCredentialType.None;
  
  EndpointAddress addr = new EndpointAddress("https://&lt;domainname&gt;:777/TlsService/ServiceSecure");
  
  ChannelFactory&lt;DeviceObservationConsumer_PortType&gt; myChannelFactory = new ChannelFactory&lt;DeviceObservationConsumer_PortType&gt;(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();
  </code></pre>
  
  <p>Both service and client are on the same PC.</p>
  
  <p>I can't access the <code>https://&lt;domanname&gt;:777/TlsService/ServiceSecure</code> via browser (get the page not found error) and for sure the client can't access it neither.
  where could be the problem could someone help me!!!!??</p>
  
  <p>Thanks in advance,</p>
  
  <p>Liudmila</p>