I was able to get this working for different projects and believe im following the same path/pattern but something is missing. I keep getting a poison message when I send a message of a known type on the MSMQ.
I have a class called ConcreteClass which has several properties, decorated with DataMember attributes. I have a "Base" class which the ConcreteClass derives from. I can send the message to the MSMQ fine but when reading from the MSMQ using WCF, the service always faults and looking at the logs, it is a poison message.
the WCF service is using the base class as the signature (which worked fine in a different project) and has serviceknowntype attributes decorated for the concrete classes the service should expect.
[ServiceKnownType(typeof(ConcreteClass))]
public sealed class WCFServiceMSMQReader : IWCFServiceMSMQReader {
[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
public void ProcessIncomingMessage(MsmqMessage<BaseClass> msg) { .... do stuff .... }
}
interface:
[ServiceContract]
public interface IWCFServiceMSMQReader {
[OperationContract(IsOneWay = true, Action = "*")]
void ProcessIncomingMessage(MsmqMessage<BaseClass> msg);
}
BaseClass:
[DataContract]
[KnownType(typeof(ConcreteClass))]
public class BaseClass
{
... some properties here...
}
ConcreteClass:
[DataContract]
public class ConcreteClass : BaseClass {
public ConcreteClass() : base() { ... stuff ... }
public ConcreteClass(params here) : base() { .... }
}
any ideas where I am going wrong?