NServiceBus无法启动 - 缺少MessageForwardinginCaseofFaultConfig

时间:2012-08-02 09:21:48

标签: msmq nservicebus

您好我正在尝试使用NServiceBus进行开发,但是我在第一步失败了。

我从命令行运行了 RunMeFirst.bat / i ,并且所有依赖项都是正确的。

c:\Users\xxxxx\Desktop\NServiceBus.3.0.0>.\binaries\NServiceBus.Host.exe /installInfrastructure
Running infrastructure installers and exiting (ignoring other command line parameters if exist).
Starting installation of PerformanceCounters
Category NServiceBus already exist, going to delete first
Installation of PerformanceCounters successful.
Checking if MSMQ is installed.
MSMQ is installed.
Checking that only needed components are active.
Installation is good.
Checking that DTC is configured correctly.
DTC is configured correctly.
DTC is good.

然而,当我尝试创建一个简单的程序并从中调用NServiceBus.exe时,它失败并出现以下错误

2012-08-02 10:19:48,922 [1] WARN  MessageForwardingInCaseOfFault [(null)] <(null)> - Could not find configuration sectio
n 'MessageForwardingInCaseOfFaultConfig'. Going to try to find the error queue defined in 'MsmqTransportConfig'.
2012-08-02 10:19:48,951 [1] FATAL NServiceBus.Hosting.GenericHost [(null)] <(null)> - System.Configuration.Configuration
ErrorsException: 'MessageForwardingInCaseOfFaultConfig' configuration section is missing and could not find backup confi
guration section 'MsmqTransportConfig' in order to locate the error queue.
   at NServiceBus.ConfigureFaultsForwarder.MessageForwardingInCaseOfFault(Configure config) in d:\BuildAgent-03\work\nsb
.masterbuild0\src\impl\faults\NServiceBus.Faults.Forwarder.Config\ConfigureFaultsForwarder.cs:line 44
   at NServiceBus.Hosting.Windows.Profiles.Handlers.ProductionProfileHandler.NServiceBus.Hosting.Profiles.IHandleProfile
.ProfileActivated() in d:\BuildAgent-03\work\nsb.masterbuild0\src\hosting\NServiceBus.Hosting.Windows\Profiles\Handlers\
ProductionProfileHandler.cs:line 19

任何帮助解决这个问题将非常感谢!

由于

2 个答案:

答案 0 :(得分:9)

当消息失败时,NSB将重试该消息,然后将其转发到另一个队列,以便继续处理。您需要将以下内容添加到配置文件中:

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

<MessageForwardingInCaseOfFaultConfig ErrorQueue="nservicebus_error" />

答案 1 :(得分:4)

只是为Adam的答案添加一些细节,配置文件是web.config,父标签如下:

<?xml version="1.0" encoding="utf-8"?>

<configuration>
    <configSections>
      <section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
      ...
    </configSections>
    <MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
    ...
</configuration>