Can a single WCF service offer multiple interfaces, and if so how would you express this in app.config
?
I mean one services offering several Interfaces
If your implementation class getting too big (like mine) try implement the super-interface in a partial class. You can put one interface implementation into one file. It's merely a convention but could be useful later.
First you need to be clear what a service is. Do you mean a single endpoint, or multiple endpoints in the same host?
Assuming you mean a single endpoint, then yes, but with a little work. An endpoint can only implement a single interface; so what you need to do is combine all the interfaces you want to implement into a single interface
public interface IMyInterface : IInterface1, IInterface2
and then implement them all inside your implementation class. What you cannot do is have multiple interfaces and multiple implementations magically merge into a single endpoint.
The following looks closer to the original goal and doesn't involve one large interface...
Multiple Endpoints at a Single ListenUri: http://msdn.microsoft.com/en-us/library/aa395210.aspx
The sample linked to above explains that it's possible to have multiple endpoints registered at the same physical address (listenUri), each implementing a different interface (contract), e.g.:
<endpoint address="urn:Stuff"
binding="wsHttpBinding"
contract="Microsoft.ServiceModel.Samples.ICalculator"
listenUri="http://localhost/servicemodelsamples/service.svc" />
<endpoint address="urn:Stuff"
binding="wsHttpBinding"
contract="Microsoft.ServiceModel.Samples.IEcho"
listenUri="http://localhost/servicemodelsamples/service.svc" />
<endpoint address="urn:OtherEcho"
binding="wsHttpBinding"
contract="Microsoft.ServiceModel.Samples.IEcho"
listenUri="http://localhost/servicemodelsamples/service.svc" />
This is possible because incoming messages are routed to the appropriate endpoint based on a combination of address and contract filters.
With WCF, you can:
Here's how you could expose the same interface on two different endpoints in your App.Config if that's what you are asking.
<service name="Service1">
<endpoint address="http://localhost:8001/service1.asmx" binding="basicHttpBinding" contract="IService" />
</service>
<service name="Service2">
<endpoint address="http://localhost:8002/service2.asmx" binding="basicHttpBinding" contract="IService" />
</service>