0

I've been working in a sandbox SharePoint site and using PnP.Framework and Microsoft.SharePointOnline.CSOM to build something my company can use for managing files programatically.

The following code actually worked for the first 10 minutes or so of debugging then starting giving me an SSL error. For reference, this is just a console app I'm using to get my head around the API.

The code:


        string clientId = "*********";
        string redirectUrl = "http://localhost";
        string tenantId = "************";
        string siteUrl = "https://5klmt2.sharepoint.com/sites/TestTeam";

        var authMan = PnP.Framework.AuthenticationManager.CreateWithInteractiveLogin(clientId, redirectUrl, tenantId);

        using (ClientContext context = authMan.GetContext(siteUrl))
        {
            var web = context.Web;
            context.Load(web, w => w.Id, w => w.Title);
            context.ExecuteQuery();

            Console.WriteLine($"{web.Id} - {web.Title}");

            var documents = web.GetListByTitle("Documents", l => l.Id, l => l.Title);

            Console.WriteLine($"{documents.Id} - {documents.Title}");
        }

It breaks when it tries to ExecuteQuery, giving me the following error:

System.Net.WebException
  HResult=0x80131620
  Message=The SSL connection could not be established, see inner exception.
  Source=System.Net.Requests
  StackTrace:
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute()
   at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
   at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
   at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
   at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
   at Program.<TestStuff>d__1.MoveNext() in C:\Club Benchmarking\GitHub\SharePointCSOM\SharePointCSOM\Program.cs:line 29
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

Inner Exception 1:
HttpRequestException: The SSL connection could not be established, see inner exception.

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

Inner Exception 3:
SocketException: An existing connection was forcibly closed by the remote host.


Any help much appreciated :)

5
  • Error is saying that the connection did not complete. It may or may not be do to SSL. For example a connection may already exist and system isn't allowing a second connection. There is a connection pool and you may of used all the available connections. You should check the log files in the server to see if there is any info. Use SQL Server Management Studio and the log files can be found in the explorer under Management. Commented Aug 10, 2023 at 17:03
  • @jdweng well this isn't happening on my end w/ SQL Server, if anything it'd be the db on SharePoint. Commented Aug 10, 2023 at 17:08
  • So you application has a frontend which is a client to server connection and a backend where you have to server to database connection? The error message at client is only front end. The error is not the backend. You cannot see the backend errors at the client. Commented Aug 10, 2023 at 17:12
  • @jdweng this is just a console app. It's breaking when ExecuteQuery is called, referencing that sharepoint site, after successfully validating credentials. The weird part is that it worked for about 10 minutes before SSL errors caught up to it. Commented Aug 10, 2023 at 17:16
  • Your code is not connecting to a SQL Database. Your code is connecting to an HTTP Server. The connection is not completing. This is the Front End. You may have a Back End that connects to the database, but the backend is not running since the Front End connection never completes. Commented Aug 10, 2023 at 20:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.