c# – Multiple contracts with same bindings..How? – Education Career Blog

How do I use multiple contracts with the same binding on the same port through C# code?

Would appreciate any simple code snipplet…

Thanks so much


What about this:

public class Service : IServiceContract1, IServiceContract2

Configuration (can be easily rewritten to code if you add Endpoint instances to ServiceHost by calling AddServiceEndpoint)

  <service name="Service">
        <add baseAddress="http://localhost:8888/Service" />
    <endpoint address="first" binding="basicHttpBinding" contract="IServiceContract1" />
    <endpoint address="second" binding="basicHttpBinding" contract="IServiceContract2" />


I’m afraid there is no “simple code snippet” for this. Use the following article to get started and just add more ServiceHost objects: http://msdn.microsoft.com/en-us/library/ms733069.aspx

If you haven’t already, it would be wise to get a book on WCF.

Leave a Comment