When using octopus 1.6 we had written scripts for uninstalling/installing our NServiceBus endpoints. We have a lot of configuration that could be removed by using the Service deployment for Octopus 2. Unfortunately, our endpoint services look to install but they won’t start. Using sc.exe on the server to manually install doesn’t work. I get no output and no feedback other than the service wasn’t started.
I am assuming it’s something to do with TopShelf and the fact that that handles installation but wanted to confirm.
I have exactly the same problem. If I install the service using the standard NServiceBus.Host.exe /install the service works fine. However if I use Octopus it doesn’t.
I’m going to use some PS for now but I’d really like to know if there’s a workaround.
When you use the Octopus windows service feature, you probably have it pointing to NServiceBus.Host.exe with no arguments. But if you run NServiceBus.Host.exe /install and look at the actual service installed in Services.msc, you’ll probably find something different - chances are it passes the path to the current DLL as an argument. You’d need to use the same arguments with the Octopus windows service configuration feature for it to work the same way.
Just wondering if there’s any result from this? I’m also getting a failure when using OD to do the service install, but it works fine if I run the NSB installation command line. The error I’m getting from the install is:
@@@
The Bus.Email service does not exist; it will be created
Info 16:34:13
sc.exe create “Bus.Email” binPath= ““C:\Octopus\Applications\Live\Bus.EndPoint.Email\4.0.325_3\NServiceBus.Host.exe” /install” DisplayName= “Bus.Email” start= "auto"
Info 16:34:13
[SC] CreateService SUCCESS
Info 16:34:13
Starting the Bus.Email service
Error 16:34:44
Start-Service : Service ‘Bus.Email (Bus.Email)’ cannot be started due to the
Error 16:34:44
following error: Cannot start service Bus.Email on computer ‘.’.
Error 16:34:44
At C:\Program Files\Octopus Deploy\Tentacle\Scripts\Octopus.Features.WindowsSer
Error 16:34:44
vice_BeforePostDeploy.ps1:123 char:2
Error 16:34:44
When you use the Octopus Windows Service feature, Octopus uses sc.exe to create the service, and points the service at the exe you specify. In your output from Octopus you can see this:
So this is saying "Create a Windows Service called Bus.Email. When it starts, it should run NServiceBus.Host.exe /install". But of course, that is nonsense - NServiceBus.Host.exe /install is for installing a service, not running a service. The command should probably look more like NServiceBus.Host.exe
Then look at the service configured in the services manager - you’ll find that it actually calls NServiceBus.Host.exe with completely different arguments. Those are the settings you want to use when you create your Windows service the Octopus way.
But given NServiceBus.Host can configure the service for you, it’s probably best to just rely on that and don’t use the built-in Octopus Windows Service configuration feature.
Thanks for the explanation. I’m now using custom PS scripts in the step itself with a couple of variables thrown in. As with most things in the Octopus world, it really easy to do!
BTW - I’m recently coming from 1.6 to 2.4 and am really loving the new features and UI. Thanks, this is just brilliant!!