title: Web service client can't find endpoint of web service
body: <p>I have call to web service from windows service. Web service is referenced and all compiles with no errors and warnings. When I call method from web service I receive error which is shown below:</p>
  
  <pre><code>    Nie można odnaleźć elementu punktu końcowego o nazwie „WSHttpBinding_IWebService” i kontrakcie „RemoteServiceLancerto.IWebService” w sekcji konfiguracji klienta ServiceModel. Może to być spowodowane tym, że nie znaleziono pliku konfiguracji dla używanej aplikacji lub tym, że w elemencie klienta nie znaleziono elementu punktu końcowego pasującego do tej nazwy.
     w System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
     w System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
     w System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
     w System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
     w System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
     w System.ServiceModel.ConfigurationEndpointTrait`1.CreateSimplexFactory()
     w System.ServiceModel.ConfigurationEndpointTrait`1.CreateChannelFactory()
     w System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
     w System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
     w System.ServiceModel.ClientBase`1..ctor(String endpointConfigurationName, String remoteAddress)
     w CreativiumCounterService.DatabaseSync.getWebService() w d:\Projekty\Liczniki\CreativiumCounterService\DatabaseSync.cs:wiersz 144
     w CreativiumCounterService.DatabaseSync..ctor() w d:\Projekty\Liczniki\CreativiumCounterService\DatabaseSync.cs:wiersz 30
     w CreativiumCounterService.DatabaseSync.get_Instance() w d:\Projekty\Liczniki\CreativiumCounterService\DatabaseSync.cs:wiersz 49
     w CreativiumCounterService.CounterService.syncronizerWorker(Object sender, ElapsedEventArgs e) w d:\Projekty\Liczniki\CreativiumCounterService\CreativiumCounterService.cs:wiersz 0
  </code></pre>
  
  <p>You may want to see my client's(windows service) app.config so I show below;
   </p>
  
  <pre><code>&lt;bindings&gt;
    &lt;wsHttpBinding&gt;
      &lt;binding name="WSHttpBinding_IWebService"&gt;
        &lt;security mode="TransportWithMessageCredential"&gt;
          &lt;transport clientCredentialType="None" /&gt;
          &lt;message clientCredentialType="UserName" /&gt;
        &lt;/security&gt;
  
      &lt;/binding&gt;
    &lt;/wsHttpBinding&gt;
  &lt;/bindings&gt;
  &lt;client&gt;
    &lt;endpoint address="https://domain.domain.com/Service/Service.svc"
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IWebService"
      contract="RemoteServiceLancerto.IWebService" name="WSHttpBinding_IWebService" /&gt;
  &lt;/client&gt;
  
  &lt;behaviors&gt;
    &lt;serviceBehaviors&gt;
      &lt;behavior&gt;
        &lt;serviceMetadata httpGetEnabled="True"/&gt;
        &lt;serviceDebug includeExceptionDetailInFaults="True"/&gt;
  
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
  &lt;/behaviors&gt;
  </code></pre>
  
  <p></p>
  
  <p>Certainly this is just a part of my config (web service part) with changed web service address.</p>
  
  <p>Below is my method to get web service (which is referenced as RSL):</p>
  
  <pre><code>public RSL.WebServiceClient getWebService()
          {
              PreciousData details = PreciousData.deserialize();
              ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(IgnoreCertificateErrorHandler);
              String ConnectionString = details.getWebServiceConnectionString();
  
              RSL.WebServiceClient client = new RemoteServiceLancerto.WebServiceClient("WSHttpBinding_IWebService", ConnectionString);
  
              client.ClientCredentials.UserName.UserName = details.getWebServiceLogin();
              client.ClientCredentials.UserName.Password = details.getWebServicePassword();
  
  
  client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
              return client;
          }
  </code></pre>
  
  <p>At the moment I have no certificate validation in IgnoreCertificateErrorHandler but I show it below:</p>
  
  <pre><code> public bool IgnoreCertificateErrorHandler(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate,
              System.Security.Cryptography.X509Certificates.X509Chain chain, SslPolicyErrors sslPolicyErrors)
          {
              return true;
          }
  </code></pre>
  
  <p>In addition if I reference web service in casual WinForms app and then I use same code to call out methods from web service then it works. If more details is needed I can provide it. I must mention that web service was tested before troubles start after moving to web service. I've almost forgot. I call web service from System.Timers.Timer elapsed event.</p>