Configuration of WCF End points in Web.config return There was no endpoint listening at that could accept the message
<p>Well. I have my client layer which has </p>

<ul>
<li>Client Contracts project which is class library contains my Service Contracts</li>
<li>Client Proxies which is class library and implement the Client Contracts</li>
<li>Client Entities which is class library to be used in client contracts and client proxies</li>
<li><p>Client Bootstrapper which is class library to be used for MEF loader purpose
and I have my web mvc project which controllers are api to call my service 
and I add refrence for all lient layers in my web project 
then configure my service in the web.config file as </p>

<pre><code>   &lt;system.serviceModel&gt;
&lt;client&gt;
  &lt;endpoint address="http://localhost:3167/CountryClient" 
            binding="basicHttpBinding" 
            contract="Client.Contracts.ICountryService"&gt;
     &lt;identity&gt;
        &lt;dns value="localhost" /&gt;
      &lt;/identity&gt;
  &lt;/endpoint&gt;
  &lt;endpoint address="mex" 
            binding="mexTcpBinding" 
            contract="IMetadataExchange" /&gt;
&lt;/client&gt;

&lt;behaviors&gt;
  &lt;serviceBehaviors&gt;
    &lt;behavior&gt;
      &lt;serviceMetadata httpGetEnabled="true" /&gt;
      &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt;
    &lt;/behavior&gt;
  &lt;/serviceBehaviors&gt;
&lt;/behaviors&gt;
</code></pre>

<p></p></li>
</ul>

<p>and my client proxy class </p>

<pre><code>namespace Client.Proxies
        {
            [Export(typeof(ICountryService))]
            [PartCreationPolicy(CreationPolicy.NonShared)]
            public class CountryClient : ClientBase&lt;ICountryService&gt;, ICountryService
            {
                public Entities.Country[] GetAllCountriess(int? Take, int? Skip)
                {
                    return Channel.GetAllCountriess(Take, Skip);
                }
            }
        }
</code></pre>

<p>and my Contract as following :</p>

<pre><code>namespace Client.Contracts
{
    [ServiceContract]
    public interface ICountryService : IServiceContract
    {
        [OperationContract]
        Country[] GetAllCountriess(int? Take, int? Skip);
    }
}
</code></pre>

<p>when running my web using visual studio : Error happened once i'm in return channel 
Error saying that There was no endpoint listening at <a href="http://localhost:3167/CountryClient" rel="nofollow">http://localhost:3167/CountryClient</a> that could accept the message
and the inner exception says: The remote server returned an error: (404) Not Found
i'm running visual studio as administrator 
I stopped the firewall
the port is not used 
not antivirus or firewall is preventing from connection </p>

<p>my Unit test is working with same configuration</p>