What you are trying to do is a direct violation of the SOA principle: "Service access scheme and contract, not class." This means that you do not actually pass the implementation code from the service to your consumers, but only the return values specified in the contract itself.
The main focus of WCF and SOA as a whole is compatibility, that is, services should be available to customers of any platform. How can a Java or C ++ user use this service you are designing? The short answer is that it cannot, so it will be difficult, if not impossible, to serialize this code compared to messaging standards such as SOAP.
A more appropriate way to structure this code would be to place each implementation of IWorkerInterface as its own service (after all, it was defined as a service contract) and expose each service to a different endpoint. Instead of the MainService acting as a remote factory for IWorkerInterface proxies, it could act as a factory endpoint for the different services that you configured. Endpoint metadata can be easily serialized and provided to the IMainService client. Then the client could take this metadata and create a proxy for the remote implementation, either through some IServiceProxy custom implementation, or even through objects already provided to you by WCF (for example, ChannelFactory).
source share