2012-12-10 30 views
1

因此,當使用NetMsmqBinding時,我能夠使用get my dead-letter service pulling from the queue。但是,當我切換到使用MsmqIntegrationBinding將消息推送到目標隊列時,死信隊列不再發送到死信服務。消息不再是WCF格式 - 它們只是XML序列化的。我不知道如何讓管道設置發送到新的服務。隊列和URL仍然匹配。如何在使用MsmqIntegrationBinding時實現基於IIS的死信服務

我試着運行,因爲它是(有netMsmqBinding),切換到msmqIntegrationBinding,並指定如下的serializationFormat:

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

然而,這一切都不似乎工作。任何想法都會受到歡迎。

回答

0

enabling WCF tracing(與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' 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),一切都開始工作。

相關問題