SQL Clone 5

"An existing connection was forcibly closed by the remote host" error

When the SQL Clone Agent installation fails, you might see an error among Windows Application Event Logs, which is similar to below one:

"An existing connection was forcibly closed by the remote host" error

System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
  at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
  at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
  --- End of inner exception stack trace ---
  at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
  at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
  --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
  at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
  --- End of inner exception stack trace ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at RedGate.SqlClone.Agent.ManagementServiceClient.JsonHttpClient.<Post>d__5`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at RedGate.SqlClone.Agent.ManagementServiceClient.RegistrationClient.<Register>d__2.MoveNext()

This error may occur when SHA512 is disabled in Windows when you use TLS 1.2 on the machine where you are trying to install the SQL Clone Agent on. You can check whether this is the case by looking at the "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010003" REG_MULTI_SZ registry value and see if you can see "RSA/SHA512" there like you do in below image:

 

We have dropped this requirement starting from the version 0.7.4 release of SQL Clone beta. If you had this issue with any older versions of SQL Clone, you can follow the below steps to resolve the issue:
  • Uninstall SQL Clone Agent from the machine that you are having problems with
  • Remove "SQL Clone Agent" certificate from local machine certificate store
  • Update the SQL Clone server to latest available release
  • Download SQL Clone Agent from the SQL Clone Web UI and install it

Didn't find what you were looking for?