Nservicebus N服务总线分发服务器/工作人员配置错误异常-';MasterNodeConfig.Node';指向本地主机名:[localhost]

Nservicebus N服务总线分发服务器/工作人员配置错误异常-';MasterNodeConfig.Node';指向本地主机名:[localhost],nservicebus,Nservicebus,我正在尝试为开发目的配置NServiceBus分发服务器/工作服务器。我安装了以下依赖项: <TransportConfig MaxRetries="5"/> <MasterNodeConfig Node="localhost"/> <UnicastBusConfig DistributorControlAddress="distributor.distributor.control@localhost" DistributorDataAddress="d

我正在尝试为开发目的配置NServiceBus分发服务器/工作服务器。我安装了以下依赖项:

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>
  • NServiceBus.Core v5.2.14
  • NServiceBus.Distributor.MSMQ v5.0.4
  • NServiceBus.Host v6.0.0
在其中一个工作进程中引发ConfigurationErrorsException,并显示以下消息:

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>
“MasterNodeConfig.Node”指向本地主机名:[localhost]

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>
这个错误的意图是明确的。指向localhost的配置违背了分布式体系结构的目的。尽管出于开发目的,这种类型的配置是最佳的。以下是我的工作程序的配置:

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>

下面的链接中有一个工作示例:

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>

将我的解决方案与上面链接中的示例进行比较,不清楚是什么原因导致我的工作人员出现ConfigurationErrorsException。有什么建议吗?

尝试为可以在一台机器上运行的分发服务器创建一个示例(根据定义,它应该在多台机器上运行)有些困难。(该示例确实讨论了在真实环境中进一步扩展。我们在顶部附近添加了一个注释以链接到该示例。)

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>
示例中不在代码中的部分是appSetting:

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>
<appSettings>
  <add 
    key="NServiceBus/Distributor/WorkerNameToUseWhileTesting" 
    value="Samples.Scaleout.Worker1" />
</appSettings>

如果存在此设置,将跳过主节点配置中的环回地址检查。不幸的是,这并没有被记录在案,可能只是为了让这个示例工作。我们将调查并解决我提出的问题

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>
然而,在现实生活中,您应该真正使用完整的机器名,而不是localhost。当然,你不能在一个样本中这样做

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>
另一项是
UnicastBusConfig
上的
MasterNodeConfig
DistributorControlAddress
/
DistributorDataAddress
属性实际上不在一起,或者不需要一起

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>

MasterNodeConfig
是一种使用完全相同的配置文件配置所有端点的简单方法。如果端点是
Sales
,主节点是
ServerA
,则控制地址是
Sales。Control@ServerA
且数据地址为
Sales@ServerA
。但这总是假设有多台机器。因此,这两个属性允许您指定可能在同一台计算机上的自定义队列。因此,如果您使用这两个属性,那么实际上根本不应该使用
MasterNodeConfig

尝试为可以在一台机器上运行的分发服务器创建一个示例,根据定义,它应该在多台机器上运行,这有点困难。(该示例确实讨论了在真实环境中进一步扩展。我们在顶部附近添加了一个注释以链接到该示例。)

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>
示例中不在代码中的部分是appSetting:

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>
<appSettings>
  <add 
    key="NServiceBus/Distributor/WorkerNameToUseWhileTesting" 
    value="Samples.Scaleout.Worker1" />
</appSettings>

如果存在此设置,将跳过主节点配置中的环回地址检查。不幸的是,这并没有被记录在案,可能只是为了让这个示例工作。我们将调查并解决我提出的问题

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>
然而,在现实生活中,您应该真正使用完整的机器名,而不是localhost。当然,你不能在一个样本中这样做

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>
另一项是
UnicastBusConfig
上的
MasterNodeConfig
DistributorControlAddress
/
DistributorDataAddress
属性实际上不在一起,或者不需要一起

<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>

MasterNodeConfig
是一种使用完全相同的配置文件配置所有端点的简单方法。如果端点是
Sales
,主节点是
ServerA
,则控制地址是
Sales。Control@ServerA
且数据地址为
Sales@ServerA
。但这总是假设有多台机器。因此,这两个属性允许您指定可能在同一台计算机上的自定义队列。因此,如果您正在使用这两个属性,那么实际上根本不应该使用
MasterNodeConfig

这是缺少的部分。谢谢你,大卫。@Pietro根据你的发布时间表,beta NSB 6可能是一个不错的选择。特别是消除了分发服务器扩展MSMQ传输的需要。NSB 6还有许多其他优点,是一个不错的选择。然而,Special并没有说他们计划何时发布v6,但我知道有几个特定的开发人员对EOY版本持乐观态度。大卫,你想扔些更具体的东西吗?那是丢失的一块。谢谢你,大卫。@Pietro根据你的发布时间表,beta NSB 6可能是一个不错的选择。特别是消除了分发服务器扩展MSMQ传输的需要。NSB 6还有许多其他优点,是一个不错的选择。然而,Special并没有说他们计划何时发布v6,但我知道有几个特定的开发人员对EOY版本持乐观态度。大卫,你想扔些更具体的东西吗?
<TransportConfig MaxRetries="5"/>

<MasterNodeConfig Node="localhost"/>
<UnicastBusConfig
  DistributorControlAddress="distributor.distributor.control@localhost"
  DistributorDataAddress="distributor@localhost">
    <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>