NServiceBus“CreateBus()”返回空值
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NServiceBus 将如果总线已创建则返回 null。因此,请确定是否有人已经为您实例化了巴士。
在我的场景中,我们定义的端点配置不一致。在一个进程中,我们将实现 IConfigureThisEndpoint,然后显式配置并实例化总线。在另一个进程中,我们将从
AsA_Publisher
继承,它隐式为您创建总线;当需要为其他进程显式定义总线配置时,我们会在 FluentCreateBus
方法上抛出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 fromAsA_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 throwNullReferenceException
on the fluentCreateBus
method. Removing theAsA_Publisher
inheritance resolved the issue.Hope this helps!