title: WCF Configuration for Endpoint in Another Project
body: <p>I have two projects in a single solution. One project, let's call it MainProject, becomes an executable. The other project, let's call it ControlsProject, contains <code>UserControl</code>'s and is referenced (and used) within the MainProject. The ControlsProject also has a WCF Service Reference. </p>
  
  <p>I have a two questions regarding this configuration:</p>
  
  <ol>
  <li>Can I just copy the WCF configuration from the ControlsProject to the MainProject (which I don't believe I can per " <a href="https://stackoverflow.com/questions/6174273/how-to-include-web-reference-endpoint-configuration-in-another-project">How to include Web reference endpoint configuration in another project</a> ")</li>
  <li>In the ControlsProject configuration, the contract doesn't have a fully qualified namespace but rather a name such as '<code>ServiceName.IServiceInterfaceName</code>'. What should the contract name be since the ControlsProject output will be a file located in the bin folder of the MainProject?</li>
  </ol>
  
  <p>I've tried just copying the configuration over, but received the exception: "<code>Could not find default endpoint element that references contract 'MyService.IMyService' 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.</code>" When I copied over the configuration, I fully qualified the name of the interface as <code>ControlsProject.MyService.IMyService</code>.</p>
  
  <p>Any help you can provide is appreciated!</p>
  
  <p><strong>UPDATE</strong> <em>(7/14/2011 5:28pm EST)</em></p>
  
  <p>Here is the snippet from my client app.config:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
      &lt;bindings&gt;
          &lt;basicHttpBinding&gt;
              &lt;binding name="BasicHttpBinding_IStatService" closeTimeout="00:01:00"
                  openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                  allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                  maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                  messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                  useDefaultWebProxy="true"&gt;
                  &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                      maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                  &lt;security mode="None"&gt;
                      &lt;transport clientCredentialType="None" proxyCredentialType="None"
                          realm="" /&gt;
                      &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                  &lt;/security&gt;
              &lt;/binding&gt;
          &lt;/basicHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;client&gt;
          &lt;endpoint address="http://intranet/StatService.svc"
              binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IStatService"
              contract="StatService.IStatService" name="BasicHttpBinding_IStatService" /&gt;
      &lt;/client&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>Here is the snippet from my web service web.config:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
    &lt;behaviors&gt;
      &lt;serviceBehaviors&gt;
        &lt;behavior name=""&gt;
          &lt;serviceMetadata httpGetEnabled="true" /&gt;
          &lt;serviceDebug includeExceptionDetailInFaults="true" /&gt;
        &lt;/behavior&gt;
      &lt;/serviceBehaviors&gt;
    &lt;/behaviors&gt;
    &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>