You will face below issue.
{“The underlying connection was closed: An unexpected error occurred on a send.”}
Solution: –
Reason behind this issue Dynamics 365 version 9.0 following TLS 1.2.
That means you are not able to connect Dynamics 365 until you enforce TLS 1.2 before your connection.
So you need to use below code before creating connection.
Due to TLS 1.2 our plugin registration tool stopped working for Dynamics 365 9.0 or online trial version. Can need to download new plugin registration tool either from Nuget. or download from below link.
Plugin Registration 9.0
Original Post https://dotnetdeveloper2012.blogspot.com/2018/05/dynamics-365-tls-connection-issue.html