2.6版本总线不能启动两次
当我们从 NServiceBus 2.5 版本升级到 2.6 版本时,我们发现了行为的变化。在 2.5 版本中,我们可以多次创建总线,但在 2.6 版本中,CreateBus()
在第二次调用后返回 null
。 谁能解释为什么?
我已阅读发行说明,但找不到有关此行为更改的任何信息。 如果您尝试使用这两个版本的 NServiceBus,下面的代码将重现该行为。
var busStartable = NServiceBus.Configure.With().Log4Net()
.DefaultBuilder()
.MsmqTransport()
.UnicastBus()
.CreateBus();
var bus = busStartable.Start();
var busStartable2 = NServiceBus.Configure.With().Log4Net()
.DefaultBuilder()
.MsmqTransport()
.UnicastBus()
.CreateBus(); // returns null with 2.6
var bus2 = busStartable2.Start(); // Object reference not set to ….
When we upgraded from version 2.5 of NServiceBus to version 2.6, we discovered a change of behavior. In version 2.5 we could create a bus multiple times but in version 2.6 the CreateBus()
returned null
after the second time of invocation.
Can anyone explain why?
I have read the release notes and can’t find anything about this change of behavior.
The code below will reproduce the behavior if you try it with these two versions of NServiceBus.
var busStartable = NServiceBus.Configure.With().Log4Net()
.DefaultBuilder()
.MsmqTransport()
.UnicastBus()
.CreateBus();
var bus = busStartable.Start();
var busStartable2 = NServiceBus.Configure.With().Log4Net()
.DefaultBuilder()
.MsmqTransport()
.UnicastBus()
.CreateBus(); // returns null with 2.6
var bus2 = busStartable2.Start(); // Object reference not set to ….
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不支持在同一应用程序域中拥有两个总线对象。我不知道为什么这在 2.5 版本中有效,但它不应该:)
Having two bus objects in the same app domain isn't supported. I'm not sure why this worked in version 2.5 but it shouldn't have :)