Use workflow service with msmqIntegrationBinding
I have been struggling with setting up a workflow service that uses a msmqIntegrationBinding. The problem I have now is that I always get this serialization exception "System.ServiceModel.ProtocolException: An error was encountered while deserializing the message. The message cannot be received. ---> System.Runtime.Serialization.SerializationException: An error occurred while deserializing an MSMQ message's XML body. The message cannot be received. Ensure that the service cont开发者_高级运维ract is decorated with appropriate [ServiceKnownType] attributes or the TargetSerializationTypes property is set on the MsmqIntegrationBindingElement."
As far as I have understood is that the serialization helper cannot find any types to serialize the message to even though I am using the generic type MsmqMessage<MyMessageType> both in the service contract and in the workflow.
MyMessageType is generated from an .xsd with xsd.exe.
UPDATE: PROBLEM SOLVED I did all settings for WCF (Action, ServiceKnownType...) on the contract (interface) instead of doing it in the workflow. When I moved it to the workflow everything started to work!!
As a WCF beginner this had me a bit stumped. I had missed the [ServiceKnownType]
attribute when going through a MSDN MSMQ example.
[ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")]
[ServiceKnownType(typeof(PurchaseOrder))]
public interface IOrderProcessor
{
[OperationContract(IsOneWay = true, Action = "*")]
void SubmitPurchaseOrder(MsmqMessage<PurchaseOrder> msg);
}
精彩评论