title: WCF Service exporting 1 Interface with 2 Implementation classes
body: <p>I'm new to WCF and C#.</p>
  
  <p>I'm trying to create a WCF Service with 1 Interface (IA) with 1 method (Do) which has 2 implementations (A1 &amp; A2).</p>
  
  <p>A silly example:</p>
  
  <p><strong>IA.cs:</strong></p>
  
  <pre><code>namespace IA_NS
  {
      [ServiceContract]
      public interface IA
      {
          [OperationContract]
          int Do(B b);
      }
  
      [DataContract]
      public class B
      {
          [DataMember]
          public string b1 { get; set; }
      }
  }
  </code></pre>
  
  <p><strong>A1.cs:</strong></p>
  
  <pre><code>namespace A1_NS
  {
      public class A1 : IA
      {
          public int Do(B b) {...}
      }
  }
  </code></pre>
  
  <p><strong>A2.cs:</strong></p>
  
  <pre><code>namespace A2_NS
  {
      public class A2 : IA
      {
          public int Do(B b) {...}
      }
  }
  </code></pre>
  
  <p><strong>My Self-Hosting-Console, where I host both services:</strong></p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          ServiceHost hostA1 = new ServiceHost(typeof(A1_NS.A1));
          hostA1.Open();
          ServiceHost hostA2 = new ServiceHost(typeof(A2_NS.A2));
          hostA2.Open();
          Console.WriteLine("Hit any key to exit...");
          Console.ReadLine();
          hostA1.Close();
          hostA2.Close();
      }
  }
  </code></pre>
  
  <p>I want my WCF Client to be able to call both classes:</p>
  
  <p><strong>Client.cs:</strong></p>
  
  <pre><code>namespace Client_NS
  {
      class Program
      {
          static void Main(string[] args)
          {
              B myB = new B();
              A1 a1 = new A1();
              A2 a2 = new A2();
              A1.Do(myB);
              A2.Do(myB);
          }
      }
  }
  </code></pre>
  
  <p>No luck ;-(</p>
  
  <p>I tried putting 2  elements in my WCF-Service <strong>app.config</strong>:</p>
  
  <pre><code>&lt;service name="A1_NS.A1" &gt;
      &lt;endpoint address="http://localhost/A1"
                contract="IA_NS.IA" /&gt;
  &lt;/service&gt;
  &lt;service name="A2_NS.A2" &gt;
      &lt;endpoint address="http://localhost/A2"
                contract="IA_NS.IA" /&gt;
  &lt;/service&gt;
  </code></pre>
  
  <p>When running the debugger - the debugging app (WCF Service Host) lets me test the Do() method of both classes.</p>
  
  <p>I can't get my Client to do it. I added Service References for both services.
  Is it the Client app.config  or am I misunderstanding something?</p>