Hello,
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
Hello,
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
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.
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)
<services>
<service name="Service">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8888/Service" />
</baseAddresses>
</host>
<endpoint address="first" binding="basicHttpBinding" contract="IServiceContract1" />
<endpoint address="second" binding="basicHttpBinding" contract="IServiceContract2" />
</service>
</services>