简体   繁体   中英

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 contract 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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM