1

因此,当使用 NetMsmqBinding 时,我能够从队列中提取死信服务。但是,当我切换到使用 MsmqIntegrationBinding 将消息推送到目标队列时,死信队列不再发送到死信服务。消息不再是 WCF 格式的——它们只是 XML 序列化的。我不确定如何让管道设置发送到新服务。队列和 URL 仍然匹配。

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

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

然而,这些似乎都不起作用。任何想法都会受到欢迎。

4

1 回答 1

0

启用 WCF 跟踪(使用)后switchValue="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 的博客中,我们发现了以下信息:

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 示例中看到的那样,使用 MsmqIntegrationBinding 需要一个接受所有消息的操作(Action = "*"[或者,实际上,Action = ""可能也可以工作])。一旦我切换到 msmqIntegrationBinding 并切换了我的合同(确保我还有ServiceKnownType新合同),一切都开始工作了。

于 2012-12-11T16:20:03.077 回答