title: Service can't find endpoint of other service in WCF
body: <p>I am trying to create two WCF services which should be able to access each other. However I am getting this error message:
  The server encountered an error processing the request. The exception message is 'Could not find default endpoint element that references contract 'AddonWCFService.IService1' 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.'. </p>
  
  <p>I call the Test() Method from this service</p>
  
  <pre><code>namespace CustomersService
  {
      [ServiceContract]
      public interface ICustomers
      {
          [OperationContract] 
          [WebGet]
          string Test();
      }
  
      public class Customers : ICustomers
      {
          private int m_i = 0;
  
          public int GetCounter()
          {
              return m_i;
          }
  
          public void Test()
          {
              AddonWCFService.Service1Client foo = new AddonWCFService.Service1Client();
          }
      }
  }
  </code></pre>
  
  <p>The other service</p>
  
  <pre><code>namespace AddonWCFWebservice
  {
      [ServiceContract]
      public interface IService1
      {
          [OperationContract]
          void Init();
      }
  
  
      public class Service1 : IService1
      {
          public void Init()
          {
  
          }
      }
  }
  </code></pre>
  
  <p>My webconfig:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
      &lt;system.serviceModel&gt;
          &lt;services&gt;
  
              &lt;service behaviorConfiguration="MyserviceBehavior" name="CustomersService.Customers"&gt;
                  &lt;endpoint name="ws" address="ws" binding="wsHttpBinding" contract="CustomersService.ICustomers"/&gt;
                  &lt;endpoint name=""
                            address="" 
                            binding="webHttpBinding" 
                            contract="CustomersService.ICustomers" 
                            behaviorConfiguration="WebBehavior"/&gt;
                  &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/&gt;
              &lt;/service&gt;
              &lt;service name="AddonWCFWebservice.Service1" behaviorConfiguration="MyserviceBehavior"&gt;
                  &lt;endpoint address="" binding="wsHttpBinding" contract="AddonWCFWebservice.IService1"/&gt;
                  &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/&gt;
              &lt;/service&gt;
          &lt;/services&gt;
          &lt;behaviors&gt;
              &lt;serviceBehaviors&gt;
                  &lt;behavior name="MyserviceBehavior"&gt;
                      &lt;serviceMetadata httpGetEnabled="true"/&gt;
                      &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
                  &lt;/behavior&gt;
              &lt;/serviceBehaviors&gt;
              &lt;endpointBehaviors&gt;
                  &lt;behavior name="WebBehavior"&gt;
                      &lt;webHttp /&gt;
                  &lt;/behavior&gt;
              &lt;/endpointBehaviors&gt;
          &lt;/behaviors&gt;
      &lt;/system.serviceModel&gt;
      &lt;system.web&gt;
          &lt;compilation debug="true"/&gt;        
          &lt;customErrors mode="Off"/&gt;
      &lt;/system.web&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Both services reside in the same active directory of IIS . I added the service reference to the VS C# projects using the web URL i.e. <a href="http://www.foobar.baz/Test/Service1.svc" rel="nofollow">http://www.foobar.baz/Test/Service1.svc</a> and <a href="http://www.foobar.baz/Test/Customers.svc" rel="nofollow">http://www.foobar.baz/Test/Customers.svc</a> </p>
  
  <p>It's probably something obvious but I'm fairly new to the whole WCF business. Thanks!</p>
  
  <p><strong>Update</strong>: The solution was to add a client section to my webconfig. Also I used basicHttpBinding over wsHttpBinding because my security will be incorparated elsewhere because it is a public service. I had to match the binding of the client to the binding of the service section: both basicHttpBinding</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
      &lt;system.serviceModel&gt;
          &lt;client&gt;
            &lt;endpoint
              name=""
              address="http://demo.mydomain.baz/TestService/Service1.svc"
              binding="basicHttpBinding"
              contract="AddonWCFService.IService1" /&gt;
          &lt;/client&gt;
  
          &lt;services&gt;
              &lt;service behaviorConfiguration="MyserviceBehavior" name="CustomersService.Customers"&gt;
                  &lt;endpoint name="ws" address="ws" binding="wsHttpBinding" contract="CustomersService.ICustomers"/&gt;
                  &lt;endpoint name=""
                            address="" 
                            binding="webHttpBinding" 
                            contract="CustomersService.ICustomers" 
                            behaviorConfiguration="WebBehavior"/&gt;
                  &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/&gt;
              &lt;/service&gt;
              &lt;service name="AddonWCFWebservice.Service1" behaviorConfiguration="MyserviceBehavior"&gt;
                  &lt;endpoint address="" binding="basicHttpBinding" contract="AddonWCFWebservice.IService1"/&gt;
                  &lt;!--
                  &lt;endpoint address="" 
                            binding="webHttpBinding" 
                            contract="AddonWCFWebservice.IService1"
                            behaviorConfiguration="WebBehavior"/&gt;
                  --&gt;
                  &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/&gt;
              &lt;/service&gt;
  
  
          &lt;/services&gt;
          &lt;behaviors&gt;
              &lt;serviceBehaviors&gt;
                  &lt;behavior name="MyserviceBehavior"&gt;
                      &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt;
                      &lt;serviceMetadata httpGetEnabled="true"/&gt;
                      &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --&gt;
                      &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
                  &lt;/behavior&gt;
              &lt;/serviceBehaviors&gt;
              &lt;endpointBehaviors&gt;
                  &lt;behavior name="WebBehavior"&gt;
                      &lt;webHttp /&gt;
                  &lt;/behavior&gt;
              &lt;/endpointBehaviors&gt;
          &lt;/behaviors&gt;
      &lt;/system.serviceModel&gt;
      &lt;system.web&gt;
          &lt;compilation debug="true"/&gt;        
          &lt;customErrors mode="Off"/&gt;
      &lt;/system.web&gt;
  &lt;/configuration&gt;
  </code></pre>