<p>I have a WCF Web Service which is referenced from a class library. After the project is run, when creating the service client object from inside a class library, I receive an InvalidOperationException with message:</p>

<blockquote>
  <p>Could not find default endpoint element that references contract
  'MyServiceReference.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.</p>
</blockquote>

<p>The code I am using to create the instance is:</p>

<pre><code>myServiceClient = new MyServiceClient();
</code></pre>

<p>where MyServiceClient inherits from</p>

<p>System.ServiceModel.ClientBase</p>

<p>How do I solve this?</p>

<p>Note: I have a seperate console application which simply creates the same service object and makes calls to it and it works without no problems.</p>

It would probably help if you posted your app.config file, since this kind of error tends to point to a problem in the
```
<endpoint>
```
block.  Make sure the contract attribute seems right to you.
Edit: Try fully qualifying your contract value; use the full namespace.  I think that is needed.