【问题标题】:Upgrading to NServiceBus 3.2.2 exception when starting endpoint启动端点时升级到 NServiceBus 3.2.2 异常
【发布时间】:2012-06-08 17:46:44
【问题描述】:

我最近使用 Nuget 将我的发布者/订阅者解决方案升级到了 NServiceBus 版本 3.2.2。我的 NServiceBus 发布者和订阅者都是自托管的。

发布者代码:

我使用 NServiceBus.Host.exe 启动 NServiceBus 发布者(调试启动操作 - 在项目属性中启动外部程序)。

app.config:

<?xml version="1.0" encoding="utf-8"?>
 <configuration>
  <configSections>
    <section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig,  NServiceBus.Core" />
    <section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
    <section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
  </configSections>
  <MsmqTransportConfig ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5" />
  <UnicastBusConfig ForwardReceivedMessagesTo="">
    <MessageEndpointMappings></MessageEndpointMappings>
  </UnicastBusConfig>
  <MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
</configuration>

EndpointConfig.cs:

namespace TrackEventPublisher.EventPublisher
{
   [EndpointName("EventPublisher")]
   public class EndpointConfig : IConfigureThisEndpoint, AsA_Publisher
   {
   }
}

我在运行发布者时遇到以下错误:

启动端点时出现异常,已记录错误。原因:在“RavenTimeoutPersistence”类型上调用构造函数“Void .ctor(Raven.Client.IDocumentStore)”时引发异常。

堆栈跟踪:

在 NServiceBus.Hosting.GenericHost.Start() 在 d:\BuildAgent-03\work\nsb.master22\src\hosting\NServiceBus.Hosting\GenericHost.cs:line 45 在 d:\BuildAgent-03\work\nsb.master22\src\hosting\NServiceBus.Hosting.Windows\WindowsHost.cs:line 56 中的 NServiceBus.Hosting.Windows.WindowsHost.Start() 在 NServiceBus.Hosting.Windows.Program.c_DisplayClass8.b_4(WindowsHost 服务) 在 d:\BuildAgent-03\work\nsb.master22\src\hosting\NServiceBus.Hosting.Windows \Program.cs:第 95 行 在 Topshelf.Internal.ControllerDelegates1.StartActionObject(Object obj) in d:\dev\open-source\topshelf\src\Topshelf\Internal\ControllerDelegates.cs:line 18 at Topshelf.Internal.IsolatedServiceControllerWrapper1.c_DisplayClass2.b_1(TService 服务) 在 d:\dev\open-source\topshelf\src\Topshelf\Internal\IsolatedServiceControllerWrapper.cs :第 65 行 在 Topshelf.Internal.ServiceController1.&lt;.cctor&gt;b__1(ServiceController1 sc) 在 d:\dev\open-source\topshelf\src\Topshelf\Internal\ServiceController.cs:line 35 在 Magnum.StateMachine.LambdaAction1.Execute(T instance, Event event, Object parameter) in :line 0 at Magnum.StateMachine.EventActionList1.Execute(T stateMachine, Event event, Object parameter) in :line 0

什么可能导致此错误?
谁能告诉我我的端点配置有什么问题?

我的解决方案适用于早期版本的 NServiceBus(3.0 之前的版本)。

更新: 这是内部异常消息:“无法连接到远程服务器”

Raven 服务器是否由 NServiceBus 自动启动?它似乎没有在我的机器上运行...

更新 好吧,出于某种原因,RavenDB 服务没有在我的机器上运行——尽管它被设置为自动启动。我的解决方案现在工作正常。我想我必须以艰难的方式了解 RavenDB :)。

有没有人在运行 RavenDB 服务时遇到问题?

更新

现在我的服务已启动并运行,我尝试在另一台机器上运行它。未创建 msmq 文件夹,我收到 RavenDB 不可用的错误消息。事实上,在我在不同的 Windows 操作系统机器上运行我的解决方案后,并没有安装 RavenDB 服务。我尝试运行随版本 3.2.2 发布的“RunMeFirst.bat”。但是,bat 文件会尝试使用 Visual Studio 安装扩展。如果安装了 Visual Studio,但未安装 Nuget 扩展,则会发布另一个错误。

有没有更好的方法来启用 NServiceBus.Host.exe 来安装 RavenDB 服务器和 msmq 文件夹,而无需在 Windows 操作系统机器上安装 Visual Studio 实例?

更新

哇,有史以来最多的更新!我将以下类添加到成功创建 msmq 文件夹的发布者项目中:

   class MsmqTransportConfigOverride : IWantCustomInitialization, INeedToInstallInfrastructure<Windows>
   {
      public void Init()
      {
       Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install();
      }

      public void Install(System.Security.Principal.WindowsIdentity identity)
      {
      }
   }

这个实现 IWantCustomIntialization 接口的新类似乎工作得很好。但是,我仍在努力更新我的发布者以在 Windows 主机上安装 RavenDB。我知道有一个命令行提示可以促进这一点,但还有其他方法吗?我尝试实现 INeedToInstallInfrastructure 接口,但我找不到任何示例。有人有什么想法吗?

【问题讨论】:

    标签: c# nservicebus publish-subscribe


    【解决方案1】:

    我们仅在以下情况下运行安装程序: 1. 将端点安装为 Windows 服务(如果在生产配置文件中运行 => 默认) 2.在调试模式下运行 3. 在集成/精简配置文件中运行

    这样就可以解释为什么没有创建队列(假设以上都不适合您?)

    【讨论】:

    • 你明白了,以上都不是真的。我能够使用 NServiceBus.Host32.exe /installInfrastructure(来自二进制文件夹)在我的本地驱动器上安装 RavenDB。然后我使用 c:\Windows\Microsoft.Net\Framework\v4.0.30319\InstallUtil "c:\program files\NServiceBus.Persistence\Raven.Server.exe" 来安装 RavenDB windows 服务。在那之后,我的出版商工作得很好。万岁!看起来我需要回去查看 NServiceBus 配置文件。感谢您的帮助安德烈亚斯!
    • 奇怪,我们应该自动为你安装为winservice Raven.Server?
    • 我注意到 3.2.2 版的新“RunMeFirst.bat”文件依赖于 Visual Studio 和 Nuget 扩展管理器。由于我的软件测试人员的机器没有 Visual Studio 实例,我需要一种方法来安装基础结构。命令行 NServiceBus.Host32.exe /installInfrastructure 没有自动安装和启动 Raven.Server。如果能够自动安装 Raven.Server,那就太好了。此链接显示其他有类似问题的人? tech.groups.yahoo.com/group/nservicebus/message/14190 3.2.2 版的 /installInfrastructure 是否已更改?
    • 只需在这些机器上调用 NServiceBus.host.exe /installInfrastructure(跳过 .bat 文件)。即使您使用 bat,由于最后安装了 vsextension,一切仍然有效
    • 和 /installInfrastructure 应该启动 raven 但我听说其他人也有问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-05
    • 2017-03-14
    • 1970-01-01
    • 2020-02-21
    • 1970-01-01
    相关资源
    最近更新 更多