这可能与以下内容有关: https://github.com/Particular/NServiceBus/issues/2561?
我使用的是nservicebus 5.0.3和azurestorage队列。
我得到了:
Object reference not set to an instance of an object
在代码成功通过endpointconfig后启动时 - 这里是堆栈跟踪。
at NServiceBus.Unicast.Queuing.QueuesCreator.Install(String identity, Configure config)
at NServiceBus.Features.InstallationSupport.Starter.Run(Configure config)
at NServiceBus.Configure.<Initialize>b__8(IWantToRunWhenConfigurationIsComplete o)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at NServiceBus.Configure.Initialize()
at NServiceBus.Bus.Create(BusConfiguration configuration)
at NServiceBus.GenericHost.PerformConfiguration(Action`1 moreConfiguration) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Hosting.Windows\GenericHost.cs:line 121
at NServiceBus.GenericHost.Start() in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Hosting.Windows\GenericHost.cs:line 70
at NServiceBus.Hosting.Windows.WindowsHost.Start() in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Hosting.Windows\WindowsHost.cs:line 30
at NServiceBus.Hosting.Windows.Program.<>c__DisplayClasse.<Main>b__6(WindowsHost service) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Hosting.Windows\Program.cs:line 80
at Topshelf.Internal.ControllerDelegates`1.StartActionObject(Object obj) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ControllerDelegates.cs:line 18
at Topshelf.Internal.IsolatedServiceControllerWrapper`1.<>c__DisplayClass2.<set_StartAction>b__1(TService service) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\IsolatedServiceControllerWrapper.cs:line 65
at Topshelf.Internal.ServiceController`1.<.cctor>b__1(ServiceController`1 sc) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ServiceController.cs:line 35
at Magnum.StateMachine.LambdaAction`1.Execute(T instance, Event event, Object parameter) in :line 0
at Magnum.StateMachine.EventActionList`1.Execute(T stateMachine, Event event, Object parameter) in :line 0
这是我的端点配置:
void IConfigureThisEndpoint.Customize(BusConfiguration configuration)
{
var container = BuildContainer();
configuration.EndpointName(ConfigurationManager.AppSettings["BusQueueName"]);
configuration.UseTransport<AzureStorageQueueTransport>();
configuration.UseContainer<AutofacBuilder>(c => c.ExistingLifetimeScope(container));
configuration.UsePersistence<RavenDBPersistence>();
}
private IContainer BuildContainer()
{
var builder = new ContainerBuilder();
var domainAssemblies = AppDomain.CurrentDomain.GetAssemblies();
builder.RegisterAssemblyModules(domainAssemblies);
return builder.Build();
}
答案 0 :(得分:0)
我最终从5.03降级到5.0,这解决了这个问题。