I am trying to get started using nservicle ebus using some samples from the nservicebus. I am unable to get a simple example to work. Please let me know if I am missing something
An exception was thrown while invoking the constructor ‘Void .ctor(Raven.Client.IDocumentStore)’ on type ‘RavenTimeoutPersistence’.
Magnum.StateMachine.StateMachineException was unhandled
Message=Exception occurred in Topshelf.Internal.ServiceController1[[NServiceBus.Hosting.Windows.WindowsHost, NServiceBus.Host, Version=3.2.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c]] during state Initial while handling OnStart1.HandleException(T stateMachine, Event event, Object parameter, Exception exception) in :line 0
Source=NServiceBus.Host
StackTrace:
at Magnum.StateMachine.ExceptionActionDictionary
at Magnum.StateMachine.EventActionList1.Execute(T stateMachine, Event event, Object parameter) in :line 01.Execute(T instance, Event event, Object parameter) in :line 0
at Magnum.StateMachine.EventActionBase
at Magnum.StateMachine.State1.RaiseEvent(T instance, BasicEvent1 eevent, Object value) in :line 0
at Magnum.StateMachine.StateMachine1.RaiseEvent(Event raised) in :line 01.Start() in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ServiceController.cs:line 77
at Topshelf.Internal.ServiceController
at Topshelf.Internal.IsolatedServiceControllerWrapper1.Start() in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\IsolatedServiceControllerWrapper.cs:line 401.Start() in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\FacadeToIsolatedServiceController.cs:line 62
at Topshelf.Internal.ServiceControllerProxy.Start() in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ServiceControllerProxy.cs:line 47
at Topshelf.Internal.ServiceControllerProxy.Start()
at Topshelf.Internal.FacadeToIsolatedServiceController
at Topshelf.Internal.ServiceCoordinator.Start() in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ServiceCoordinator.cs:line 48
at Topshelf.Internal.Hosts.ConsoleHost.Run() in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\Hosts\ConsoleHost.cs:line 53
at Topshelf.Internal.Actions.RunAsConsoleAction.Do(IRunConfiguration configuration) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\Actions\RunAsConsoleAction.cs:line 33
at Topshelf.Runner.Host(IRunConfiguration configuration, String[] args) in c:\Projects\TopShelfForNSB\src\Topshelf\Runner.cs:line 70
at NServiceBus.Hosting.Windows.Program.Main(String[] args) in c:\TeamCity\buildAgent\work\nsb.master_8\src\hosting\NServiceBus.Hosting.Windows\Program.cs:line 134
InnerException:
Message=Exception when starting endpoint, error has been logged. Reason: An exception was thrown while invoking the constructor ‘Void .ctor(Raven.Client.IDocumentStore)’ on type ‘RavenTimeoutPersistence’.
Source=NServiceBus.Host
StackTrace:
at NServiceBus.Hosting.GenericHost.Start() in c:\TeamCity\buildAgent\work\nsb.master_8\src\hosting\NServiceBus.Hosting\GenericHost.cs:line 45
at NServiceBus.Hosting.Windows.WindowsHost.Start() in c:\TeamCity\buildAgent\work\nsb.master_8\src\hosting\NServiceBus.Hosting.Windows\WindowsHost.cs:line 56
at NServiceBus.Hosting.Windows.Program.<>c_DisplayClass8.b_4(WindowsHost service) in c:\TeamCity\buildAgent\work\nsb.master_8\src\hosting\NServiceBus.Hosting.Windows\Program.cs:line 97
at Topshelf.Internal.ControllerDelegates1.StartActionObject(Object obj) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ControllerDelegates.cs:line 181.<>c_DisplayClass2.b_1(TService service) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\IsolatedServiceControllerWrapper.cs:line 65
at Topshelf.Internal.IsolatedServiceControllerWrapper
at Topshelf.Internal.ServiceController1.<.cctor>b__1(ServiceController1 sc) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ServiceController.cs:line 35
at Magnum.StateMachine.LambdaAction1.Execute(T instance, Event event, Object parameter) in :line 01.Execute(T stateMachine, Event event, Object parameter) in :line 0
at Magnum.StateMachine.EventActionList
InnerException: Autofac.Core.DependencyResolutionException
Message=An exception was thrown while invoking the constructor ‘Void .ctor(Raven.Client.IDocumentStore)’ on type ‘RavenTimeoutPersistence’.
Source=NServiceBus.Core
StackTrace:
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters)1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable
at Autofac.Core.Resolving.InstanceLookup.b_6()
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator)1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable
at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters)1 parameters, Object& instance)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters)1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
at Autofac.Core.Activators.Reflection.AutowiringPropertyInjector.InjectProperties(IComponentContext context, Object instance, Boolean overrideSetValues)
at Autofac.Builder.RegistrationBuilder3.<>c__DisplayClassd.<PropertiesAutowired>b__c(Object s, ActivatingEventArgs1 e)
at System.EventHandler1.Invoke(Object sender, TEventArgs e)1 parameters, Object& instance)
at Autofac.Core.Registration.ComponentRegistration.RaiseActivating(IComponentContext context, IEnumerable
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)1 creator)
at Autofac.Core.Resolving.InstanceLookup.<Execute>b__6()
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters)1 parameters)
at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable
at Autofac.Features.Collections.CollectionRegistrationSource.<>c_DisplayClass4.<>c_DisplayClass6.b_1(IComponentRegistration cr)
at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext()1..ctor(IEnumerable
at System.Linq.Buffer1 source)1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable
at Autofac.Features.Collections.CollectionRegistrationSource.<>c_DisplayClass4.b_0(IComponentContext c, IEnumerable1 p)1 parameters)
at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable
at Autofac.Core.Resolving.ResolveOperation.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters)1 parameters)
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters)1 parameters)
at Autofac.Core.Container.ResolveComponent(IComponentRegistration registration, IEnumerable
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance)1 parameters)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable1 parameters)1.MoveNext()
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
at NServiceBus.ObjectBuilder.Autofac.Internal.ContainerExtensions.ResolveAll(IComponentContext container, Type componentType)
at NServiceBus.ObjectBuilder.Autofac.AutofacObjectBuilder.BuildAll(Type typeToBuild)
at NServiceBus.ObjectBuilder.Common.CommonObjectBuilder.<NServiceBus.ObjectBuilder.IBuilder.BuildAll>d__1
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)1 getResponse)
at NServiceBus.Unicast.Config.StartupRunners.<Run>b__4(Object obj, EventArgs ev)
at NServiceBus.Unicast.UnicastBus.NServiceBus.IStartableBus.Start(Action startupAction)
at NServiceBus.Unicast.UnicastBus.NServiceBus.IStartableBus.Start()
at NServiceBus.Hosting.GenericHost.Start() in c:\TeamCity\buildAgent\work\nsb.master_8\src\hosting\NServiceBus.Hosting\GenericHost.cs:line 32
InnerException: System.Net.WebException
Message=The remote server returned an error: (401) Unauthorized.
Source=System
StackTrace:
at System.Net.HttpWebRequest.GetResponse()
at Raven.Client.Connection.HttpJsonRequest.ReadStringInternal(Func
at Raven.Client.Connection.HttpJsonRequest.ReadResponseString()
at Raven.Client.Connection.HttpJsonRequest.ExecuteRequest()
at Raven.Client.Connection.ServerClient.DirectPutIndex(String name, String operationUrl, Boolean overwrite, IndexDefinition definition)
at Raven.Client.Connection.ServerClient.<>c_DisplayClass34.b_33(String operationUrl)
at Raven.Client.Connection.ServerClient.TryOperation[T](Func2 operation, String operationUrl, Boolean avoidThrowing, T& result)2 operation)
at Raven.Client.Connection.ServerClient.ExecuteWithReplication[T](String method, Func
at Raven.Client.Connection.ServerClient.PutIndex(String name, IndexDefinition definition, Boolean overwrite)
at Raven.Client.Connection.ServerClient.PutIndex[TDocument,TReduceResult](String name, IndexDefinitionBuilder`2 indexDef, Boolean overwrite)
at NServiceBus.Timeout.Hosting.Windows.Persistence.RavenTimeoutPersistence..ctor(IDocumentStore store)
InnerException:
I figured out the problem. When i created a new MVC project a default connection string was added.
It appears that Nservicebus sees the presence of that connect string as some kind of indicator to use ravendb for persistence etc..Once I removed it, samples started to work