The OctopusDeploy Tentacle service failed to re-start

We setup windows scheduler task to re-start the Tentacle service on some target servers but few of them failed to start the Tentacle service automatically. The errors were as below
Opening a new connection
2017-08-24 08:48:29 Error
One or more errors occurred.
System.AggregateException: One or more errors occurred. —> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it [::ffff:48.24.142.27]:10933
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.Sockets.TcpClient.EndConnect(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization)
— End of inner exception stack trace —
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait(TimeSpan timeout)
at Halibut.Transport.TcpClientExtensions.ConnectWithTimeout(TcpClient client, String host, Int32 port, TimeSpan timeout)
at Halibut.Transport.SecureClient.CreateConnectedTcpClient(ServiceEndPoint endPoint)
at Halibut.Transport.SecureClient.EstablishNewConnection()
at Halibut.Transport.SecureClient.AcquireConnection()
at Halibut.Transport.SecureClient.ExecuteTransaction(Action1 protocolHandler) ---> (Inner Exception #0) System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it [::ffff:48.24.142.27]:10933 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.Sockets.TcpClient.EndConnect(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task`1 promise, Boolean requiresSynchronization)<—

Hi Eric,

Thank you for getting in touch. Where is this message coming from?

Could you please send me the log files from a Tentacle that fails to start?

Also could you send me the command and/or script that the scheduled task runs along with the output of the scheduled task?

Does your scheduled task wait for the service to stop before attempting to start it again?

Just so I get a clear picture, why do you need to restart the Tentacles?

Robert W