title: Error while consuming a webservice
body: <p>I have a webservice provided by a client that I need to consume.</p>
  
  <p>I tested the webservice using WCFTestClient. &amp; I confirmed that the service is working.</p>
  
  <p>Now, I want to consume the webservice using C# code. I added the url of the webservice as a service reference .</p>
  
  <p>I named my service reference as PG_WS .
  I finished a part of my code.</p>
  
  <p>When I try to debug the code, as soon as I reach the line :</p>
  
  <pre><code> PG_WS.ServiceSoapClient ws = new PG_WS.ServiceSoapClient();
  </code></pre>
  
  <p>I get an error saying : </p>
  
  <pre><code>    Message: System.InvalidOperationException: Could not find default endpoint 
  element that references contract 'PG_WS.ServiceSoap' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
         at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
         at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
         at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
         at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
         at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
         at System.ServiceModel.ConfigurationEndpointTrait`1.CreateSimplexFactory()
         at System.ServiceModel.ConfigurationEndpointTrait`1.CreateChannelFactory()
         at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
         at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
         at System.ServiceModel.ClientBase`1..ctor()
  </code></pre>
  
  <p>I have been stuck at this point , not knowing what the error means and what I can do next. Please let me know if you have any ideas.</p>