title: Host multiple contracts in one WCF service
body: <p>Is it possible to host multiple service contracts in one WCF service? If so, how? I've been googling and some posts say you can do it (but not how) and others have said it's just not possible.</p>
  
  <p>When I run the server, I get this error:</p>
  
  <blockquote>
    <p>The contract name 'ConsoleAppWcfCommon.IBarService' could not be found
    in the list of contracts implemented by the service
    'ConsoleAppWcfServer.FooService'.</p>
  </blockquote>
  
  <p><strong>This is my server code:</strong></p>
  
  <pre><code>    static void Main(string[] args)
      {
          string serviceAddress = "net.tcp://localhost:8088/FooBarService";
  
          // I'm stuck here as I have to pick *one* service
          ServiceHost selfServiceHost = new ServiceHost(typeof(FooService));            
  
          // I can add both endpoints here, but this is what gives me the error.
          selfServiceHost.AddServiceEndpoint(typeof(IFooService), new NetTcpBinding(), serviceAddress);
          selfServiceHost.AddServiceEndpoint(typeof(IBarService), new NetTcpBinding(), serviceAddress);
  
          selfServiceHost.Open();
          Console.ReadLine();
          selfServiceHost.Close();
      }
  </code></pre>
  
  <p><strong>And this is the client code:</strong></p>
  
  <pre><code>    static void Main(string[] args)
      {
          NetTcpBinding netTcpBinding = new NetTcpBinding();
  
          EndpointAddress endpointAddress = new EndpointAddress("net.tcp://localhost:8088/FooBarService");
  
          // Call IFooService
          var channelFactoryFoo = new ChannelFactory&lt;IFooService&gt;(netTcpBinding, endpointAddress);
          IFooService channelFoo = channelFactoryFoo.CreateChannel();
          Debug.WriteLine(channelFoo.FooMethod1());
  
          // Call IBarService
          var channelFactoryBar = new ChannelFactory&lt;IBarService&gt;(netTcpBinding, endpointAddress);
          IBarService channelBar = channelFactoryBar.CreateChannel();
          Debug.WriteLine(channelBar.BarMethod1());
      }
  </code></pre>
  
  <p>My goal is to let the client make a call to Foo (or Bar) and only see the methods available to each. In my real application, I have about 10 domain entities with about four operations on each. I'm trying not to have one interface with 40 methods in it. And I don't want to have to host 10 different WCF services to do this.</p>