NServiceBus 中不自动创建队列
我正在运行 NServiceBus 3.0.0 rc2,但是当我启动应用程序(作为本地管理员)而不预先创建 MSMQ 时,会出现错误:
队列不存在或您没有足够的权限来执行该操作。
使用 NServiceBus 2.6 时不会发生这种情况。
下面是我的配置:
var bus = Configure.With()
.Log4Net()
.NinjectBuilder()
.XmlSerializer()
.DefiningCommandsAs(t => typeof(ICommand).IsAssignableFrom(t))
.DefiningEventsAs(t => typeof(IEvent).IsAssignableFrom(t))
.DefiningMessagesAs(t => typeof(IMessage).IsAssignableFrom(t))
.MsmqTransport()
.DefineEndpointName("subscriber.input")
.IsTransactional(true)
.PurgeOnStartup(false)
.UnicastBus()
.LoadMessageHandlers()
.ImpersonateSender(false)
.CreateBus()
.Start();
我
<configuration>
<configSections>
<section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
</configSections>
<MsmqTransportConfig ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="MyEvents" Endpoint="publisher.input" />
</MessageEndpointMappings>
</UnicastBusConfig>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
可以看到一个配置扩展方法来禁用自动创建队列,但没有启用它。
如果我预先创建队列,它就可以正常工作。
I'm running NServiceBus 3.0.0 rc2 but when I start the application (as local admin) without pre-creating the MSMQ's it errors with :
The queue does not exist or you do not have sufficient permissions to perform the operation.
This was not happening using NServiceBus 2.6.
Below is my config:
var bus = Configure.With()
.Log4Net()
.NinjectBuilder()
.XmlSerializer()
.DefiningCommandsAs(t => typeof(ICommand).IsAssignableFrom(t))
.DefiningEventsAs(t => typeof(IEvent).IsAssignableFrom(t))
.DefiningMessagesAs(t => typeof(IMessage).IsAssignableFrom(t))
.MsmqTransport()
.DefineEndpointName("subscriber.input")
.IsTransactional(true)
.PurgeOnStartup(false)
.UnicastBus()
.LoadMessageHandlers()
.ImpersonateSender(false)
.CreateBus()
.Start();
and
<configuration>
<configSections>
<section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
</configSections>
<MsmqTransportConfig ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="MyEvents" Endpoint="publisher.input" />
</MessageEndpointMappings>
</UnicastBusConfig>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
I can see a config extension method to disable automatic creation of queues but none for enabling it.
If I pre-create the queues it works fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您自行托管时,安装程序不会自动运行。请参阅 global.asax.cs asyncpages 示例 有关如何手动执行此操作的示例。
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.
我通过在客户端手动创建队列(这是自托管的)来解决这个问题。
不确定,但我认为 2.x 会自动执行此操作。
主机会按预期自动创建队列,但客户端不会(自托管)。
更新:像 Andreas 一样,guardo camino 先生指出,您需要像这样手动调用安装;
这将按预期创建队列。
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;
This will create the queues as expected.