title: WCF: Cannot find endpoint reference
body: <p>I am working on a SharePoint 2013 webpart and a label on the webpart needs to communicate with a SQL Server data table using WCF. I have created the WCF interface and main class, and have also invoked the service in my Visual webpart like this:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
      {
          WcfServiceReference1.Service1Client client = new WcfServiceReference1.Service1Client();
          CustomerNameLbl.Text = client.GetCustomerName(ProjectIDDescLbl.Text);
      }
  </code></pre>
  
  <p>Where WcfServiceReference1 is the added WCF service reference and a customer label text is being changed depending on the project number label. The project builds and deploys fine but when I add the webpart, I get this error: <strong>Could not find default endpoint element that references contract 'WcfServiceReference1.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.</strong></p>
  
  <p>My app.config file is this:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
      &lt;bindings&gt;
          &lt;basicHttpBinding&gt;
              &lt;binding name="BasicHttpBinding_IService1" /&gt;
          &lt;/basicHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;client&gt;
          &lt;endpoint address="http://as-sv-dev02:2345/Service1.svc" binding="basicHttpBinding"
              bindingConfiguration="BasicHttpBinding_IService1" contract="WcfServiceReference1.IService1"
              name="BasicHttpBinding_IService1" /&gt;
      &lt;/client&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>And web.config file (for SharePoint) is this:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
  &lt;bindings&gt;
          &lt;basicHttpBinding&gt;
              &lt;binding name="BasicHttpBinding_IService1" /&gt;
          &lt;/basicHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;client&gt;
          &lt;endpoint address="http://as-sv-dev02:2345/Service1.svc" binding="basicHttpBinding"
              bindingConfiguration="BasicHttpBinding_IService1" contract="WcfServiceReference1.IService1"
              name="BasicHttpBinding_IService1" /&gt;
      &lt;/client&gt;
  </code></pre>
  
  <p></p>
  
  <p>Can anyone guide me on how to resolve this? Am I going wrong somewhere?</p>