Windows Service install via Powershell "hanging"

We’re using custom step templates to install X number of Windows Service instances written with TopShelf. The backing powershell is using a standard Get-Service [service name + wildcard] | start-service -PassThru to start all of our Windows Services in the event the number of instances to deploy is the same number of instances already deployed. We are seeing lots of issues where the script appears to stop/start all of the services on the machines (we are deploying to 2 machines) but the server never seems to get the message. We found this stack trace in one of the Tentacles’ log files:

2015-08-13 10:42:41.6007 3 ERROR Client failed authentication
System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. —> System.ComponentModel.Win32Exception: The handle specified is invalid
— End of inner exception stack trace —
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at Pipefish.Transport.SecureTcp.Server.SecureTcpServer.ExecuteRequest(TcpClient client) in y:\work\3cbe05672d69a231\source\Pipefish.Transport.SecureTcp\Server\SecureTcpServer.cs:line 112

We’re running version on the server and the Tentacles. All machines are Windows Server 2012.
We also noticed that in the Connectivity tab in the Octopus web UI we see this:

System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it at System.Net.Sockets.TcpClient.Connect(String hostname, Int32 port) at Pipefish.Transport.SecureTcp.Client.SecureTcpClient.Send(SecureTcpRequest request, Action`1 response) in y:\work\3cbe05672d69a231\source\Pipefish.Transport.SecureTcp\Client\SecureTcpClient.cs:line 54 at Pipefish.Transport.SecureTcp.MessageExchange.Client.ClientWorker.PerformExchange() in y:\work\3cbe05672d69a231\source\Pipefish.Transport.SecureTcp\MessageExchange\Client\ClientWorker.cs:line 353 at Pipefish.Transport.SecureTcp.MessageExchange.Client.ClientWorker.Run() in y:\work\3cbe05672d69a231\source\Pipefish.Transport.SecureTcp\MessageExchange\Client\ClientWorker.cs:line 187

We notice that simply retrying will sometimes work. We also disabled the TCP offloading on the Tentacles after reading a similar post.
We can execute the powershell script on the tentacles without issues.

Can you help us out?


After more probing, we realized one of the Tentacles was version and the other was We’ve uninstalled both tentacles and are reinstalling with now. Both Tentacles were also configured as Listening. We’ve changed them to Polling. We’ve since done 5 straight deployments with no issue, so maybe the combination of changing to Polling and upgrading to did the trick.

Hi Chris,
Glad to hear you got this one sorted out by yourself. :slight_smile: Sometimes it just takes a little elbow grease to wrangle all the servers to get set up just right.
Let me know if you run into any further troubles.