Update the Discovery Agent in Closed Networks

Platform Notice: Cloud and Data Center - This article applies equally to both cloud and data center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

When updating the Discovery Agent using "discovery_agent.exe -update" on a closed network, an error occurs: "Connection closed." No additional information is provided.

Solution

Through a command prompt, go to the Discovery Agent folder and run "discovery_agent -update". The following will be logged:

5/7/2025 1:45:29 PM: [Normal] The underlying connection was closed: An unexpected error occurred on a send. at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result) at System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Insight.Discovery.Tools.Networking.DownloadClient.<DownloadFileAsync>d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Insight.Discovery.Tools.Update.UpdateService.<DownloadDiscoveryBinaries>d__17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Insight.Discovery.Tools.Update.UpdateService.<UpdateAsync>d__15.MoveNext() 5/7/2025 1:45:29 PM: [Normal] Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) 5/7/2025 1:45:29 PM: [Normal] An existing connection was forcibly closed by the remote host

Workaround - Option 1:

Download the Discovery Tools on a machine that has access to the internet, and then copy the zip to the remote host.

Workaround - Option 2:

Add the following URLs to the firewall allowlist:

https://marketplace.atlassian.com https://packages.atlassian.com

Then run the "discovery_agent -update". Alternatively, the following PowerShell script can be used as well, as long as the host can reach out to those same URLs:

$uri = "https://marketplace.atlassian.com/rest/2/addons/com.riadalabs.jira.plugins.insight-discovery/versions/latest?hosting=cloud" $response = Invoke-RestMethod -Uri $uri -Method Get $discoveryVersion = $response.name $downloadPath = Join-Path -Path "$([System.Environment]::GetFolderPath(40))" -ChildPath "Downloads" $packageSaveName = "assets-discovery-${discoveryVersion}.zip" $outFilePath = Join-Path $downloadPath $packageSaveName $extractFolder = Join-Path $downloadPath "ad-install" $agentMsiPath = Join-Path $extractFolder "Discovery_Agent_Setup.msi" Write-Host "Downloading ${discoveryVersion} to ${downloadPath}" Invoke-WebRequest $response.vendorLinks.binary -OutFile $outFilePath Expand-Archive $outFilePath -DestinationPath $extractFolder -Force $params = '/i', $agentMsiPath, 'TARGETDIR="C:\Program Files\Atlassian\Discovery Agent"', '/qn' msiexec $params Wait-Event -Timeout 20 msiexec $params

Updated on May 27, 2025

Still need help?

The Atlassian Community is here for you.