Installing NServiceBus as a Windows Service with dependency on RavenDb

nservicebus, ravendb

Solution

You can pass a dependencies list eg:

NServiceBus.Host.exe /install /dependsOn:"MSMQ,RavenDB"

The list needs to be comma delimmited.

In v4 the command line args are a bit different:

NServiceBus.Host.exe -install -dependsOn=MSMQ -dependsOn=RavenDB

Problem

When we install an NServiceBus 3.3.6 endpoint as a Windows service using the /install flag, it is automatically configured with a windows service dependency on Message Queuing. However, even though our NServiceBus endpoints use RavenDb for persistence, the installer does not configure a service dependency on RavenDb. This means that when our server restarts most of our NServiceBus endpoints fail to start up due to the following exception: ``` System.InvalidOperationException: The database {name} is currently being loaded, but after 30 seconds, this request has been aborted. Please try again later, database loading continues. ``` Is there any way to tell NServiceBus to set up a dependency on RavenDb or is this something we have to configure manually, perhaps using `INeedToInstallSomething<T>`?

Original source