Exchange Web Service: False message of ‘Unable to read data from the transport connection’

So we are using Exchange on-premise Web Services (/EWS/Exchange.asmx) to send Calendar Invites (S+) automatically when people register for trainings, but on the recent scheduled job, suddenly the C# App throws errror:

First thing that we want to check of course is Firewall. Nope, I can browse https://exchange/EWS/Exchange.asmx just fine.

Second thing is to blame Exchange, maybe there’s a recent change? Since the app does not change at all. But going through IIS Logs of Exchange CAS is troublesome (the log files are 200MB daily!) Anyways, we could not see the IP trying to connect to Exchange Web Service.

Sooooo, it must be the client app right? But the code did not change, so why suddenly it stopped working?

Finally I figured it out: Since there is no proof of connection in Exchange log files, that means the C# app didn’t even connect successfully to the Web Service. But then we were able to browse Exchange.asmx? What about the TLS Version? To check this, use classic Internet Explorer, right-click the Exchange.asmx page, and check the Connection Protocol, booyah!

And .NET 4.5 uses SSL3 & TLS 1.1…. So now we know the issue and why connection is dropped: we are using different protocols. The issue is then simple enough with this one-liner of C# code:

That’s it, hope you may want to check the TLS version now every time you get “An existing connection was forcibly closed by the remote host” šŸ™‚

Leave a Reply