使用MsmqIntegrationBinding时如何实现基于IIS的死信服务

时间:2012-12-10 22:32:47

标签: wcf iis msmq

因此,在使用NetMsmqBinding时我能够get my dead-letter service pulling from the queue。但是,当我切换到使用MsmqIntegrationBinding将消息推送到目标队列时,死信队列不再发送到死信服务。消息不再是WCF格式的 - 它们只是XML序列化的。我不知道如何让管道设置发送到新服务。队列和URL仍然匹配。

我已尝试按原样运行(使用netMsmqBinding),切换到msmqIntegrationBinding,并指定serializationFormat,如下所示:

<bindings>
  <msmqIntegrationBinding>
    <binding exactlyOnce="true" durable="true" serializationFormat="Xml">
      <security mode="Transport" />
    </binding>
  </msmqIntegrationBinding>
</bindings>

但是,这似乎都不起作用。任何想法都会受到欢迎。

1 个答案:

答案 0 :(得分:0)

enabling WCF tracingswitchValue="All")之后,我能够看到我收到以下异常:

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.

找到为我的每个类型添加ServiceKnownType的正确合约后,我遇到了另外的例外情况:

The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

Simon Evans' Blog,我们可以找到以下信息:

MsmqIntegrationBinding requires contracts that are designed only for its use. Unless additional behaviors are applied to the dispatcher, the service contract can contain only one service operation.

基本上,正如我们在MSDN example中看到的那样,使用MsmqIntegrationBinding需要一个接受所有消息的操作(Action = "*" [或者,真的,Action = ""可能也可以正常工作]) 。一旦我切换到msmqIntegrationBinding并切换了我的合同(确保我在新的合同上仍然有ServiceKnownType),一切都开始有效了。

相关问题