2012-11-01 92 views
1

由於未配置ISendMessages,我遇到了將錯誤消息轉發到錯誤隊列的問題。NServicebus無法將錯誤消息轉發到錯誤隊列

我有以下幾個部分我app.config文件

<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" /> 

<MessageForwardingInCaseOfFaultConfig ErrorQueue="nservicebus_error" /> 

<add key="ConnectivityRetryPeriod" value="30" /> 
<add key="FatalRetryCount" value="2" /> 
<add key="RetryFrequency" value="2" /> 

然而,超過FatalRetryCount的時候,我得到了以下異常

System.InvalidOperationException occurred 
    Message=Could not forward failed message to error queue, reason: System.ArgumentException: NServiceBus.Unicast.Queuing.ISendMessages has not been configured. In order to avoid this exception, check the return value of the 'HasComponent' method for this type. 
    at NServiceBus.ObjectBuilder.Spring.SpringObjectBuilder.NServiceBus.ObjectBuilder.Common.IContainer.Build(Type typeToBuild) 
    at NServiceBus.ObjectBuilder.Common.CommonObjectBuilder.NServiceBus.ObjectBuilder.IBuilder.Build[T]() 
    at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, String reason). 
    Source=NServiceBus.Core 
    StackTrace: 
     at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, String reason) 
    InnerException: System.ArgumentException 
     Message=NServiceBus.Unicast.Queuing.ISendMessages has not been configured. In order to avoid this exception, check the return value of the 'HasComponent' method for this type. 
     Source=NServiceBus.ObjectBuilder.Spring 
     StackTrace: 
      at NServiceBus.ObjectBuilder.Spring.SpringObjectBuilder.NServiceBus.ObjectBuilder.Common.IContainer.Build(Type typeToBuild) 
      at NServiceBus.ObjectBuilder.Common.CommonObjectBuilder.NServiceBus.ObjectBuilder.IBuilder.Build[T]() 
      at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, String reason) 

具體而言,這種異常登錄NServiceBus.Faults.Forwarder命名空間中的FaultManager.cs中的以下留置權

Line where the error is thrown

這裏是在app.config部分和配置的代碼,我使用

App.Config sections

Config code

+0

您可以發佈您的端點配置代碼嗎? –

+0

我更新了配置代碼 – infinity

+0

的帖子我認爲Adam的意思是「Configure.With()...」代碼,通常命名爲EndpointConfig.cs。 –

回答

0

得到了修復,從NServiceBus支持團隊這個問題,它看起來像ISendMessages被註冊當我明確地調用.MsmqTransport()。我更新了配置代碼來調用.MsmqTransport()和FaultManager停止拋出此異常