The contract implementation type to use is defined when the ServiceHost
instance is created. If you have multiple endpoints served by the same ServiceHost, it will create an instance of the same type to respond to requests to these endpoints.
If you want two endpoints for the same contract to use different implementations, you have two choices:
- expose the two endpoints on two separate service hosts. (Either through creating two
ServiceHost
instances or specifying two <service>
configuration elements);
- have a composite implementation for the class that has two separate implementations of the same interface (through any OOP approach you can think of) and dispatches the calls to these based on the endpoint address.
I personally would stick with the first approach. If you go for the second approach, you would be essentially reimplementing ServiceHost
yourself.