Not creating queues automatically in NServiceBus

好久不见. 提交于 2019-11-30 05:02:00
Andreas Öhlund

Installers are not run automatically when you self host. Please see the global.asax.cs in the asyncpages sample for a example on how to do it manually.

using NServiceBus
using NServiceBus.Installation.Environments
...
Bus = Configure.With()
    .Log4Net()
    .DefaultBuilder()
    .XmlSerializer()
    .MsmqTransport()
    .IsTransactional(false)
    .PurgeOnStartup(false)
    .UnicastBus()
    .ImpersonateSender(false)
    .CreateBus()
    .Start(() => Configure.Instance.ForInstallationOn<Windows>().Install());

I got around this by creating the queue on the client side manually (which is self hosted).

Not sure, but I thought 2.x did this automatically. Host is creating the queues automatically, as expected, but not the client (self hosted).

UPDATE: Like Andreas, senor guardo camino, stated, you need to call install manually like so;

.Start(() => Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install());

This will create the queues as expected.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!