[英]Use workflow service with msmqIntegrationBinding
I have been struggling with setting up a workflow service that uses a msmqIntegrationBinding. 我一直在努力设置使用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."
我现在遇到的问题是,我总是收到此序列化异常“ System.ServiceModel.ProtocolException:反序列化消息时遇到错误。无法接收到消息。---> System.Runtime.Serialization.SerializationException:发生了错误反序列化MSMQ消息的XML正文时,无法接收该消息。请确保服务合同已使用适当的[ServiceKnownType]属性进行修饰,或者已在MsmqIntegrationBindingElement上设置了TargetSerializationTypes属性。
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. 据我了解,即使我在服务合同和工作流程中都使用通用类型MsmqMessage <MyMessageType> ,序列化帮助程序也找不到将消息序列化为的任何类型。
MyMessageType is generated from an .xsd with xsd.exe. MyMessageType是使用xsd.exe从.xsd生成的。
UPDATE: PROBLEM SOLVED I did all settings for WCF (Action, ServiceKnownType...) on the contract (interface) instead of doing it in the workflow. 更新:解决了问题我在合同(接口)上进行了WCF(动作,ServiceKnownType ...)的所有设置,而不是在工作流中进行了所有设置。 When I moved it to the workflow everything started to work!!
当我将其移至工作流程时,一切都开始工作!!
As a WCF beginner this had me a bit stumped. 作为WCF初学者,这让我有些困惑。 I had missed the
[ServiceKnownType]
attribute when going through a MSDN MSMQ example . 通过MSDN MSMQ 示例时,我错过了
[ServiceKnownType]
属性。
[ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")]
[ServiceKnownType(typeof(PurchaseOrder))]
public interface IOrderProcessor
{
[OperationContract(IsOneWay = true, Action = "*")]
void SubmitPurchaseOrder(MsmqMessage<PurchaseOrder> msg);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.