'The request was aborted: Could not create SSL/TLS secure channel in CSOM
Getting below error, Please suggest any solution.
The request was aborted: Could not create SSL/TLS secure channel on windows server2012 R2. at clientContext.ExecuteQuery.
Code for CSOM SharePoint:
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12
| SecurityProtocolType.Ssl3;
using (ClientContext ctx = new ClientContext("test.SharePoint.Com"))
{
try
{
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
ctx.AuthenticationMode = ClientAuthenticationMode.Default;
SecureString securePassword = new SecureString();
foreach (char c in "test")
securePassword.AppendChar(c);
ctx.Credentials = new SharePointOnlineCredentials("test.com", securePassword);
Web web = ctx.Web;
ctx.Load(web);
ctx.ExecuteQuery(); //The request was aborted: Could not create SSL/TLS secure channel.
Console.WriteLine("The web site title: " + web.Title);
Console.Read();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
