D365 business events error

Problem

Starting February 2020 a strange thing happened on our D365: all business events connected to Microsoft Flow suddenly stopped working. Under the errors tab in business events workspace, it shows this exception: The underlying connection was closed: An unexpected error occurred on a send. The underlying connection was closed: An unexpected error occurred on a send.

Doing some research hasn’t helped much - all I got is this exception message is somehow related to security protocols and TLS 1.2.

Turns out this error occurs only if you are using .NET version 4.5 or older. The server your application makes a request to does not support obsolete security protocols and you must use TLS 1.2.

And then I remembered - I’ve received a couple of emails from Microsoft, telling they are dropping TLS 1.0 and 1.1 support starting February 1st, 2020. But that was for another Azure service: Action required email

I haven’t received anything similar regarding business events or Flow.

Solution

Usually that error is fixed by adding a line of code to your project, telling .NET to use newer protocol. But in our case, that is the standard functionality we can’t tamper with. Turns out there is an alternative - .NET will use stronger cryptography if you have SchUseStrongCrypto registry key set to 1. There is even a PowerShell snippet from Performance SDK troubleshooting page that sets this key:

Set-ItemProperty HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 -Name SchUseStrongCrypto -Value 1 -Type dword -Force -Confirm:$false
if ((Test-Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319)) 
{
    Set-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319 -Name SchUseStrongCrypto -Value 1 -Type dword -Force -Confirm:$false 
}

And in fact, that was a solution. After a server reboot, I was able to resend failed business events as well as send new ones.

That was a strange error. I couldn’t find any information from Microsoft about Flow servers being upgraded, nor any other mentions of this exception in the scope of D365 business events. It must be a one-off case with our environment being rather old and not very well upgraded (however, installing Windows Server updates didn’t help). I hope this helps somebody having the same issue.

Share