Problem
While upgrading a .NET customisation that interfaced with our client Dynamics 365 online environment (Version 9). I encountered the following error while attempting to fetch some records from our Dynamics 365 instance.
The same code had previously worked without issue in our Dynamics 365 Version 8 environment.
“Metadata contains a reference that cannot be resolved: ‘https://XXXX.api.crm6.dynamics.com/XRMServices/2011/Organization.svc?wsdl&sdkversion=9’.”
{“The underlying connection was closed: An unexpected error occurred on a send.”}
{“Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.”}
“The underlying connection was closed: An unexpected error occurred on a send.”
Solution
As per the below Microsoft article Dynamics 365 now requires TLS 1.2
https://support.microsoft.com/en-au/help/4051700
The solution is to either:
- Use .NET framework version 4.6 which uses TLS 1.2 by default
or
- Add the below line of code to your app (before making calls to Dynamics 365) to explicitly enable TLS 1.2
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
- Solved: Build Errors Not Showning in VS 2022 - 21st November 2024
- How To: Configure VSCode to Trust Self-Signed Certs - 16th August 2024
- Solved: GitHub Actions – HTTP 403: Resource not accessible by integration - 13th June 2024
Leave a Reply