VSTS Build Step Push Packages to Octopus Failed Because Target Machine Actively Refused It

cli's Avatar

cli

09 Nov, 2017 10:27 PM

I got this message when tried to push NuGet package to Octopus Deploy Server:
System.Exception: Unable to connect to the Octopus Deploy server. See the inner exception for details. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it XXX.X.X.X:90 2017-11-07T15:01:26.6979296Z at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
2017-11-07T15:01:26.6989305Z at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
2017-11-07T15:01:26.6989305Z --- End of inner exception stack trace ---
2017-11-07T15:01:26.6989305Z at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
2017-11-07T15:01:26.6989305Z at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
2017-11-07T15:01:26.6989305Z --- End of inner exception stack trace ---
2017-11-07T15:01:26.6989305Z at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-11-07T15:01:26.6989305Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-11-07T15:01:26.6989305Z at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
2017-11-07T15:01:26.6989305Z at Octopus.Client.OctopusAsyncClient.d_
51`1.MoveNext()
2017-11-07T15:01:26.6989305Z --- End of stack trace from previous location where exception was thrown ---
2017-11-07T15:01:26.6989305Z at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-11-07T15:01:26.6989305Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-11-07T15:01:26.6989305Z at Octopus.Client.OctopusAsyncClient.d30`1.MoveNext()
2017-11-07T15:01:26.6989305Z --- End of stack trace from previous location where exception was thrown ---
2017-11-07T15:01:26.6989305Z at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-11-07T15:01:26.6989305Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-11-07T15:01:26.6989305Z at Octopus.Client.OctopusAsyncClient.d
50.MoveNext()
2017-11-07T15:01:26.6989305Z --- End of inner exception stack trace ---
2017-11-07T15:01:26.6999293Z at Octopus.Client.OctopusAsyncClient.d
50.MoveNext()
2017-11-07T15:01:26.6999293Z --- End of stack trace from previous location where exception was thrown ---
2017-11-07T15:01:26.6999293Z at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-11-07T15:01:26.6999293Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-11-07T15:01:26.6999293Z at Octopus.Client.OctopusAsyncClient.d
12.MoveNext()
2017-11-07T15:01:26.6999293Z --- End of stack trace from previous location where exception was thrown ---
2017-11-07T15:01:26.6999293Z at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-11-07T15:01:26.6999293Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-11-07T15:01:26.6999293Z at Octopus.Client.OctopusAsyncClient.d
11.MoveNext()
2017-11-07T15:01:26.6999293Z --- End of stack trace from previous location where exception was thrown ---
2017-11-07T15:01:26.6999293Z at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-11-07T15:01:26.6999293Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-11-07T15:01:26.6999293Z at Octopus.Cli.Commands.ApiCommand.d
_31.MoveNext()
2017-11-07T15:01:26.6999293Z --- End of stack trace from previous location where exception was thrown ---
2017-11-07T15:01:26.6999293Z at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-11-07T15:01:26.7009299Z at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-11-07T15:01:26.7009299Z at Octopus.Cli.Program.Run(String[] args)
2017-11-07T15:01:26.7009299Z Exit code: -3
2017-11-07T15:01:26.9563774Z ##[error]Process 'Octo.exe' exited with code '-3'.

I tested push a package to Octopus from local using Octo.exe, it worked well.

Thanks.

  1. Support Staff 1 Posted by Shannon Lewis on 10 Nov, 2017 06:59 AM

    Shannon Lewis's Avatar

    Hi,

    Thanks for getting in touch and sorry to hear you're having difficulties with pushing your packages.

    The error is certainly indicating a network connectivity issue between the build environment and your Octopus server. A couple of things come to mind, could I just check though, when you said "from local" did you mean local to the Octopus server or local on your workstation?

    Could I also check you used exactly the same address for the Octopus server? In the log above it looks like you used an IP address on port 90, is that correct? Do you have an inbound rule in the server's firewall to allow port 90? If you ran locally on the Octopus server that rule wouldn't come in to play.

    I'm pretty sure Octopus will also only accept incoming requests for urls that align with its defined ListenPrefixes. Could you confirm that the address you're using in VSTS is listed in the Octopus instance's ListenPrefixes? Have you also tried Octo.exe on a machine external to the network the Octopus server is on? I.e. maybe a local machine can route to the IP address but it isn't externally visible?

    Regards
    Shannon

  2. 2 Posted by cli on 13 Nov, 2017 04:31 PM

    cli's Avatar

    Thanks for the quick response.

    I use Octo.exe at my local workstation. I hosted Octopus Server at localhost, so I guess it also means local to the Octopus server?

    Yes, I use exactly port 90 for Octopus Server which is http://localhost:90/. I had added an inbound rule for port 90 in my local workstation’s firewall.

    How can I check Octopus instance's ListenPrefixes?

    I tried use Octo.exe to push a local file to Octopus Server from VM, got the same error.

    Regards,
    Claire

  3. Support Staff 3 Posted by Shannon Lewis on 13 Nov, 2017 10:51 PM

    Shannon Lewis's Avatar

    Hi Claire,

    Could I also check, are you able to browse to the Octopus portal on the URLs you are using from the various machines? It should work when you are on the same machine as Octopus server without the firewall being an issue, so it's usually a good place to start.

    If you're accessing your host machine from inside a VM, localhost will refer to the VM and not the host, so presumably you're using the IP address from in there? To check the ListenPrefixes, the easiest way is to run Octopus Server Manager. Near the top left you'll see the current prefixes listed as Browse links. There's a Change bindings... option there to edit the values if you need to. If you're access from the VM using an IP then there'll have to be an entry for the IP address, e.g. http://xxx.x.x.x:90.

    This may get it working from your VM, but I suspect VSTS will be more difficult. Octo.exe relies on being able to connect to the Octopus server API, and your workstation would have to have a publicly available IP address for it to connect.

    Regards
    Shannon

  4. 4 Posted by cli on 13 Nov, 2017 11:24 PM

    cli's Avatar

    Hi Shannon,

    You’re right.

    I can’t use Octopus portal on various machines, since it’s a localhost.

    I tried use http://xxx.x.x.x:90 instead of http://localhost:90, it worked on VM. However, VSTS still reported an error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond xxx.x.x.x:90

    I will try to host Octopus Server on a public network to see how it works.

    Thank you very much for the quick responses and patience.

    Regard,
    Claire

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac