You need WCF services to return DTOs. They cannot be interfaces, and if you want to return abstract base classes, then you will need to tell the data serializer that implements the types that you intend to return.
He already knows about the AbstractMessage type (as his part of the operation contract), but all implementations of this type that are not explicitly declared in the operation contract must be declared in known types.
try adding this:
[ServiceContract] [ServiceKnownType(typeof(Message))] public interface IActiveDirectory { ... }
Here you tell the data serializer that this service can return (or wait) for objects of type Message as arguments for their methods.
and this should work too:
[DataContract] [KnownType(typeof(Message))] public abstract class AbstractMessage { ... }
since you want to tell the data serializer that Message is a known type of AbstractMessage
I believe that your changes did not work, because you used KnownTypes for the service instead of ServiceKnownTypes, and you tried to apply the known type to the derived class, and not to the parent class, which you do in this language (Message is AbstractMessage), but in WCF you have to flip it and put the derived implementations in the parent class (AbstractMessage has an implementation message), which can be restrictive.
you said: There something odd with WCF + Polymorphism...
Believe me, itβs better not to think of WCF as supporting polymophism, if not. You simply return the DTO, and if you want to try and make these polymorphic, you will run into many problems. Polymorphism is implemented using interfaces, and you cannot use interfaces in WCF. If you use abstract classes, due to the lack of multiple inheritance in C #, you will soon realize that a DTO can only represent one kind of your object, and you cannot create a DTO that represents several interfaces of a domain model class. (see this question on this)
See my answer here to find out how you can pass knowledge of known types, either through KnownTypes , ServiceKnownTypes or configuration.