No connection could be made because the target machine actively refused it 127.0.0.1:41000

That is the error I get when trying to deploy my test project iOSQuickStart from UE4 ver. 4.23.0-8386587

I am on a PC using the launch window to test my iOS app on my iphoneX device.
I have downloaded iTunes. The iPhone X is plugged into my PC. iTunes sees the iPhone. I can pick iOS device from the Launch pull down menu within UE4.23.
Below is the log of this error. Help would be appriciated
thanks!
Discreetfire

LOG FROM SESSION------------------------------------

LogPlayLevel: ********** DEPLOY COMMAND STARTED **********
LogPlayLevel: Running: C:\Program Files\Epic Games\UE_4.23\Engine\Binaries\DotNET\IOS\DeploymentServer.exe Install -ipa “C:\Users\rchurchill\Dropbox\CarbonJobs\Unreal Projects\iOSQuickStart\Binaries\IOS\iOSQuickStart.ipa” -device All_iOS_On_CHI-GFX-4 -additionalcommandline “-SessionId=5C7F9AA3475DF4631DA18A98EFFD19DD -SessionOwner=“rchurchill” -SessionName=”
Launch On Device" "
LogPlayLevel: Creating Deployment Server …
LogPlayLevel: Creating Deployment Server …
LogPlayLevel: Creating Deployment Server …
LogPlayLevel: Creating Deployment Server …
LogPlayLevel: Creating Deployment Server …
LogPlayLevel: Creating Deployment Server …
LogPlayLevel: Creating Deployment Server …
LogPlayLevel: Creating Deployment Server …
LogPlayLevel: Creating Deployment Server …
LogPlayLevel: Creating Deployment Server …
LogPlayLevel: Unhandled Exception: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:41000
LogPlayLevel: at DeploymentServer.Program.GetServiceClient(String LocalCommand) in D:\Build++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\IOS\DeploymentServer\Program.cs:line 725
LogPlayLevel: at DeploymentServer.Program.ClientLoop(String[] Args, String LocalCommand) in D:\Build++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\IOS\DeploymentServer\Program.cs:line 1022
LogPlayLevel: at DeploymentServer.Program.Main(String[] Args) in D:\Build++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\IOS\DeploymentServer\Program.cs:line 1169
LogPlayLevel: Took 53.1065493s to run DeploymentServer.exe, ExitCode=-532462766
LogPlayLevel: Command failed (Result:-532462766): C:\Program Files\Epic Games\UE_4.23\Engine\Binaries\DotNET\IOS\DeploymentServer.exe Install -ipa “C:\Users\rchurchill\Dropbox\CarbonJobs\Unreal Projects\iOSQuickStart\Binaries\IOS\iOSQuickStart.ipa” -device All_iOS_On_CHI-GFX-4 -additionalcommandline "-SessionId=5C7F9AA3475DF4631DA18A98EFFD19DD -SessionOwner=
“rchurchill” -SessionName=“Launch On Device” ". See logfile for details: ‘DeploymentServer-2019.10.29-13.31.30.txt’
LogPlayLevel: AutomationTool exiting with ExitCode=-532462766 (-532462766)
LogPlayLevel: Completed Launch On Stage: Deploy Task, Time: 112.774277
LogPlayLevel: BUILD FAILED

This issue appears to occur if you’ve installed iTunes through the Windows Store rather than as a standalone executable. It appears that the Deployment Server has a dependency on iTunes and fails to start correctly when the Windows Store version is installed.

To fix it:

  • From your windows Start Menu, find iTunes, right-click it and uninstall it.
  • Head over to the iTunes download page. Do not use the “Get it from
    Microsoft” link. Use the “Looking for other versions” link instead to download the installer and install it as a standalone application.

In my case, since the Unreal Editor was still running while I performed the install, as soon as the new iTunes installed itself, Windows Firewall opened a dialog box asking me whether I wanted to allow Deployment Server access.

iOS builds on the PC worked after that.

1 Like

This error is a network-related error occurred while establishing a connection to the Server. It means that the error is occurring because there is no server listening at the hostname and port you assigned. It literally means that the machine exists but that it has no services listening on the specified port . So, no connection can be established. Generally, it happens that something is preventing a connection to the port or hostname. Either there is a firewall blocking the connection or the process that is hosting the service is not listening on that specific port. This may be because it is not running at all or because it is listening on a different port. So, no connection can be established.

Try running netstat -anb from the command line to see if there’s anything listening on the port you were entered. If you get nothing, try changing your port number and see if that works for you. In Windows operating systems, you can use the netstat services via the command line (cmd.exe) . On Linux you may need to do netstat -anp instead.

The target machine actively refused it occasionally , it is likely because the server has a full ‘backlog’ . Regardless of whether you can increase the server backlog , you do need retry logic in your client code, sometimes it cope with this issue; as even with a long backlog the server might be receiving lots of other requests on that port at that time.

I’m just dropping by to thank KevODoom for posting this solution - your solution solved the issue I was having. iTunes was installed via MS Store and UAT consistently failed.

Uninstalled, installed standalone iTunes version (I used my own .exe from 2017 and it updated). UAT worked this time! Thanks for taking the time to post the solution!

1 Like