Microsoft Flow deprecated TLS 1.0 and 1.1

By Mirek on (tags: External services, Microsoft, MS Flow, TLS, categories: architecture)

We’ve recently stumbled upon some strange error in one of our websites. The problem was the Microsoft Flow server started to rejecting connections constantly.

The website that caused the problem was built on .net framework 4.5.2 and integrated with MS Flow to accomplish some business processes. As it turned out Microsoft has recently deprecated the TLS 1.0 and 1.1 in more of its services as described here.
And since TLS. 1.2 is used by default starting from .net Framework 4.6 the MS Flow Server rejected connection which resulted with following error:

Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

So there are two ways to fix that. Either we update the website to .net Framework 4.6 or put this simeple fix in application startup:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

and problem is gone.

Cheers