NServiceBus“CreateBus()”返回空值

发布于 2024-12-31 20:55:00 字数 1409 浏览 1 评论 0原文

我在 Windows Server 2003 32 位上使用 NServiceBus 2.6.0.1504。

生成的日志文件表明一切都已连接完毕,但由于某种原因,“CreateBus()”返回 null。忽略我的调试代码:)

        SetLoggingLibrary.Log4Net(log4net.Config.XmlConfigurator.Configure);

        var one = Configure.With(typeFinder.GetAssemblies());
        var two = one.DefaultBuilder();
        var three = two.MsmqSubscriptionStorage();
        var four = three.XmlSerializer();
        var five = four.MsmqTransport();
        var six = five.IsTransactional(false);
        var seven = six.PurgeOnStartup(true);
        var eight = seven.UnicastBus();
        var nine = eight.LoadMessageHandlers();
        var ten = nine.ImpersonateSender(false);
        var eleven = ten.CreateBus();
        if (eleven == null)
            throw new Exception("createbus");
        var twelve = eleven.Start();

总是抛出消息“createbus”的异常。

这适用于我的 Windows Server 2008 R2 64 位开发机。

这是我的网络应用程序的配置。

  <MsmqSubscriptionStorageConfig Queue="MedXChangeSubcriptions" />
  <MsmqTransportConfig InputQueue="MedXChangeForms" ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5" />
  <UnicastBusConfig>
    <MessageEndpointMappings>
      <add Messages="MethodFactory.MedXChange.Library" Endpoint="MedXChangeWeb" />
    </MessageEndpointMappings>
  </UnicastBusConfig>

有什么想法吗?任何帮助将不胜感激。

I am using NServiceBus 2.6.0.1504 on windows server 2003 32 bit.

The log file generated indicates that everything is getting wired up, but for some reason, "CreateBus()" returns null. Ignore my debugging code :)

        SetLoggingLibrary.Log4Net(log4net.Config.XmlConfigurator.Configure);

        var one = Configure.With(typeFinder.GetAssemblies());
        var two = one.DefaultBuilder();
        var three = two.MsmqSubscriptionStorage();
        var four = three.XmlSerializer();
        var five = four.MsmqTransport();
        var six = five.IsTransactional(false);
        var seven = six.PurgeOnStartup(true);
        var eight = seven.UnicastBus();
        var nine = eight.LoadMessageHandlers();
        var ten = nine.ImpersonateSender(false);
        var eleven = ten.CreateBus();
        if (eleven == null)
            throw new Exception("createbus");
        var twelve = eleven.Start();

The exception with the message "createbus" always gets thrown.

This works on my dev box with is Windows Server 2008 R2 64 bit.

Here is my config for the web app.

  <MsmqSubscriptionStorageConfig Queue="MedXChangeSubcriptions" />
  <MsmqTransportConfig InputQueue="MedXChangeForms" ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5" />
  <UnicastBusConfig>
    <MessageEndpointMappings>
      <add Messages="MethodFactory.MedXChange.Library" Endpoint="MedXChangeWeb" />
    </MessageEndpointMappings>
  </UnicastBusConfig>

Any ideas? Any help would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

没有你我更好 2025-01-07 20:55:00

NServiceBus 将如果总线已创建则返回 null。因此,请确定是否有人已经为您实例化了巴士。

在我的场景中,我们定义的端点配置不一致。在一个进程中,我们将实现 IConfigureThisEndpoint,然后显式配置并实例化总线。在另一个进程中,我们将从 AsA_Publisher 继承,它隐式为您创建总线;当需要为其他进程显式定义总线配置时,我们会在 Fluent CreateBus 方法上抛出 NullReferenceException 。删除 AsA_Publisher 继承解决了该问题。

希望这有帮助!

NServiceBus will return null if a bus has already been created. So determine if someone is already instantiating a bus for you.

In my scenario, we were inconsistently defining endpoint configurations. In one process, we would implement IConfigureThisEndpoint and then explicitly configure and instantiate a bus. In another process we would inherit from AsA_Publisher which implicitly creates a bus for you; and when it came time to explicitly define our bus' configuration for this other process we would throw NullReferenceException on the fluent CreateBus method. Removing the AsA_Publisher inheritance resolved the issue.

Hope this helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文