title: ASP.NET MVC : could not find endpoint element with name contract
body: <p>I had created an MVC application that had no authentication so I was advised to create a mvc project that has the 'Individual User Accounts' option selected which brings with it some controllers, models and views.</p>
  <p>What I had done to keep my old class library data was rename the current class library as Projectold in my file explorer and created a new class library in Visual Studio with the same name(Project) then imported all the controllers, views, config files that I had from my previous library and included them in the new class library.</p>
  <p>I have a proxy to 2 web services that exposes data for me to use. Because I only needed a new class library, I had the existing &lt;system.serviceModel&gt; tag already there in the existing service folder so I just copied and pasted it within the new web.config file in the new class library.</p>
  <p>What has happened is that now I cannot access the web service to access the data. I am thrown the error:</p>
  <pre><code>System.InvalidOperationException
  HResult=0x80131509
  Message=Could not find endpoint element with name 'WebServiceSoap' and contract 
  'ProxyToWebService.WebServiceSoap' 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 name could be found in the client element.
  Source=&lt;Cannot evaluate the exception source&gt;
  StackTrace:
  &lt;Cannot evaluate the exception stack trace&gt;
  </code></pre>
  <p>My web.config file is (The proxy URL's have been anonymised):</p>
  <pre><code>    &lt;system.serviceModel&gt;
      &lt;bindings&gt;
          &lt;basicHttpBinding&gt;
              &lt;binding name=&quot;WebServiceSoap&quot;/&gt;
              &lt;binding name=&quot;SWebServiceSoap&quot;/&gt;
          &lt;/basicHttpBinding&gt;
          &lt;customBinding&gt;
              &lt;binding name=&quot;WebServiceSoap12&quot;&gt;
                  &lt;textMessageEncoding messageVersion=&quot;Soap12&quot;/&gt;
                  &lt;httpTransport/&gt;
              &lt;/binding&gt;
              &lt;binding name=&quot;SWebServiceSoap12&quot;&gt;
                  &lt;textMessageEncoding messageVersion=&quot;Soap12&quot;/&gt;
                  &lt;httpTransport/&gt;
              &lt;/binding&gt;
          &lt;/customBinding&gt;
      &lt;/bindings&gt;
      &lt;client&gt;
    &lt;endpoint address=&quot;http://URL/URL/URL.asmx&quot; binding=&quot;basicHttpBinding&quot; bindingConfiguration=&quot;WebServiceSoap&quot; contract=&quot;ProxyToWebService.WebServiceSoap&quot; name=&quot;WebServiceSoap&quot; /&gt;
    &lt;endpoint address=&quot;http://URL/URL/URL.asmx&quot; binding=&quot;customBinding&quot; bindingConfiguration=&quot;WebServiceSoap12&quot; contract=&quot;ProxyToWebService.WebServiceSoap&quot; name=&quot;WebServiceSoap12&quot; /&gt;
    &lt;endpoint address=&quot;http://URL/URL/URL.asmx&quot; binding=&quot;basicHttpBinding&quot; bindingConfiguration=&quot;SWebServiceSoap&quot; contract=&quot;ProxyToSWebService.SWebServiceSoap&quot; name=&quot;SWebServiceSoap&quot; /&gt;
    &lt;endpoint address=&quot;http://URL/URL/URL.asmx&quot; binding=&quot;customBinding&quot; bindingConfiguration=&quot;SWebServiceSoap12&quot; contract=&quot;ProxyToSWebService.SWebServiceSoap&quot; name=&quot;SWebServiceSoap12&quot; /&gt;
      &lt;/client&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  <p>I have returned to a back up copy and it works before I replace my old new class library with my new class library so the endpoint connections should be okay. Just when they are used in the new class library is where it breaks.
  I cannot just copy the old web.config file either as because the Individual User Accounts option is selected, it has modified the web.config file.</p>
  <p>My code for the proxy connection:</p>
  <pre><code>        public InboundService()
      {
          proxy = new WebServiceSoapClient(&quot;WebServiceSoap&quot;, &quot;http://URL/URL/URL.asmx&quot;);
          Sproxy = new SWebServiceSoapClient(&quot;SWebServiceSoap&quot;, &quot;http://URL/URL/URL.asmx&quot;);
      }
  </code></pre>