1

I have an Octo deploy step that calls the Unicorn sync PowerShell script. Everything was working until recently:

failed Unicorn deploy step

The main error message being:

The underlying connection was closed: An unexpected error occurred on a receive.

How can I fix this?

1 Answer 1

1

We recently disabled TLS 1.0 and 1.1 on the target machine. Checking the event viewer of the target machine showed many instances of this error:

event viewer error 10013

A Google search led me to these two articles which solved the problem:

https://blog.matrixpost.net/a-fatal-error-occurred-while-creating-a-tls-client-credential-the-internal-error-state-is-10013/

https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls#systemdefaulttlsversions

In summary, the solution was to add this to the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 “SystemDefaultTlsVersions”=dword:00000001

After a reboot, the Unicorn sync began working again.

More information:

This registry key has a value of type DWORD. A value of 1 causes your app to allow the operating system to choose the protocol. A value of 0 causes your app to use protocols picked by the .NET Framework. To ensure .NET Framework applications remain secure, the TLS version should not be hardcoded. .NET Framework applications should use the TLS version the operating system (OS) supports.> If your app targets .NET Framework 4.7 or later versions, this key defaults to a value of 1. That’s a secure default that we recommend. If your app targets .NET Framework 4.6.1 or earlier versions, the key defaults to 0. In that case, you should explicitly set its value to 1. So in case of our error messages, .NET Framework was trying to use one of the disabled TLS 1.0 or TLS 1.1 client protocols. Now after setting SystemDefaultTlsVersions to 1, the operating system is now choosing the right and available protocol instead the .NET Framework itself. This change is for any version of .NET 4 and 64 Bit Applications. For versions before .NET 4 you need to add the value in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\v2.0.50727

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.