SharePoint Add-In - Exception occurred while trying to establish a connection with the remote server

Pratibha Dawar 20 Reputation points
2023-04-18T13:49:18.08+00:00

I have developed a SharePoint add-ins where I am retrieving information from a SQL server through an API that is hosted on Azure developed in asp.net web API. I am using "/_api/SP.WebProxy.invoke" method to get information from Web API. It has been working since last 3 years but now I am getting error as "An exception occurred while trying to establish a connection with the remote server - 'The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel" I checked Web API and it is working fine everywhere else, but not in SharePoint Hosted Add-In. We even checked SSL certificate and it is valid, not expired, and returns the correct response when accessed via Postman. Please help.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,916 questions
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 36,421 Reputation points Microsoft Vendor
    2023-04-20T09:24:08.2+00:00

    Hi @Pratibha Dawar , You can try to add following code to fix the issue

    System.Net.ServicePointManager.Expect100Continue = false;
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.