Windows Service Start Mode - Unchanged

I’m curious about the behavior of the Start Mode - Unchanged option. I have a service that is normally disabled in development, testing, and staging environments, but is always automatic and started in production. I looked through the documentation and couldn’t find the feature listed, I know it’s new within the past few minor versions.

My understanding would be that when the service is deployed to dev, test, or staging, it would remain disabled. This works correctly without issue. When the service is deployed to production however, the service is stopped and reconfigured, but upon startup the deployment fails with this message in Octopus.Features.WindowsService_BeforePostDeploy.ps1:

The NotificationService service already exists. It will be stopped and reconfigured.
Info 02:01:15
Stopping the NotificationService service
Info 02:01:15
sc.exe config “NotificationService” binPath= ““C:\Octopus\Applications\Production\Notification.Service\0.5.0.157\NotificationService.exe”” DisplayName= " Notification Service" start= "auto"
Info 02:01:15
[SC] ChangeServiceConfig SUCCESS
Info 02:01:15
Updating the service description
Info 02:01:15
[SC] ChangeServiceConfig2 SUCCESS
Info 02:01:17
Starting the NotificationService service
Error 02:01:48
Start-Service : Service ’ Notification Service (NotificationService)’ can
Error 02:01:48
not be started due to the following error: Cannot start service Notification
Error 02:01:48
Service on computer ‘.’.
Error 02:01:48
At C:\Octopus\Applications.SQ-NOTIFICATIONSERVER-7621F5DA\Octopus.Tentacle\2.5.5.318\Scrip
Error 02:01:48
ts\Octopus.Features.WindowsService_BeforePostDeploy.ps1:138 char:15
Error 02:01:48

  • Start-Service <<<<  $ServiceName
    

Error 02:01:48
+ CategoryInfo : OpenError: (System.ServiceProcess.ServiceControl
Error 02:01:48
ler:ServiceController) [Start-Service], ServiceCommandException
Error 02:01:48
+ FullyQualifiedErrorId : CouldNotStartService,Microsoft.PowerShell.Comman
Error 02:01:48
ds.StartServiceCommand
Fatal 02:01:48
PowerShell script returned a non-zero exit code: 1
Tentacle version 2.5.5.318

I was able to remote into the server and start the service without issue. I wanted to share this error, and also to get confirmation that with this configuration, the deployment to production should remain unchanged and it should still be automatic and started after the deployment has succeeded.

Thanks again,
Paul

Hi Paul,

Thanks for getting in touch! We aren’t sure why Octopus would be unable to start the service. Could you please check in your Windows Event Viewer for the error as to why the service was unable to start.

Many thanks!
Vanessa