I recently upgraded from Octopus Deploy 2.X to 3.2.19. When trying to deploy a Windows Service using the upgraded server, I am having an intermittent issue getting the service to deploy successfully. The error being caught by Octopus is the following…
Start-Service : Service 'MyWindowsService (MyWindowsService)' cannot be started due to the following error: Cannot start service MyWindowsService on
computer '.'.
At D:\MyWindowsServicePath\Octopus.Features.WindowsService_BeforePostDeploy.ps1:156 char:15
+ Start-Service <<<< $ServiceName
+ CategoryInfo : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException
+ FullyQualifiedErrorId : CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand
The System Windows Log has two errors that are thrown at the same time…
A timeout was reached (30000 milliseconds) while waiting for the MyWindowsService service to connect.
And
The MyWindowsService service failed to start due to the following error:
The service did not respond to the start or control request in a timely fashion.
I did see a suggestion to modify my service’s code; however, when I log into the machine and use the Windows Services console, the service starts up and is running in only a few seconds. This suggest to me that my code isn’t the issue.
I also tried setting the ServicesPipeTimeout registery key to 60000, also called out in that stackoverflow post; however the issue and the errors citing 30000 milliseconds still persist, even after several reboots.
As I mentioned, the issue is intermittent. In a deployment to 16 servers, a few of them will throw the errors. Using Guided Failures, I am able to retry and sometimes successfully deploy the service. If I re-run the whole deployment, a different set of servers will fail. The Retry ad nauseam approach eventually does succeed.
Would you please help me get my service consistently deployed?