WCF client unable to connect to WCF server with error
<p>I am unable to connect my WCF client to my WCF server on a Localhost network. The error that I am getting is the following:</p>

<blockquote>
  <p>Error while connecting to the Localhost server: 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 server connection is the following. Here is the code:</p>

<pre><code> _host = new ServiceHost(typeof(MyService));

 //Create Metadata exchange for the service
 ServiceMetadataBehavior mexBehavior = new ServiceMetadataBehavior();
 _host.Description.Behaviors.Add(mexBehavior);

 //Add service endpoints for the service and mex
 _host.AddServiceEndpoint(typeof(IMyService), new NetNamedPipeBinding(), "net.pipe://localhost/WFC_Server/MyService.svc");
 _host.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexNamedPipeBinding(), "net.pipe://localhost/WFC_Server/MyService.svc/mex");
 _host.Open();
</code></pre>

<p>I am not setting up my client to connect to the server properly. Does anybody know why? Here is the code:</p>

<pre><code> var callback = new MyServiceCallback();
 var instanceContext = new InstanceContext(callback);
 var client = new MyServiceReference.MyServiceClient(instanceContext);
 client.Endpoint.Address = new EndpointAddress("net.pipe://localhost/WFC_Server/MyService.svc");
            client.OpenSession();
</code></pre>

<p>Does anybody know why my client does not connect to the server?</p>