Skip to Content

Could not establish trust relationship for the SSL/TLS secure channel.

Hello Everyone,

I am trying to call SAP Hana Service Layer through my code but I am stumbling upon the below error : So can anyone please help me on this.

Error 1st : AuthenticationException: The remote certificate is invalid according to the validation procedure.

Error 2nd : WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

Error 3rd : HttpRequestException: An error occurred while sending the request.

Some more details about the App -I have created the console app in .net & its execute on the server [Hana Server is locally accessed as both the server are in the LAN] Linux & Windows Server.

One more thing - My client is not planning to purchase the domain name & SSL certificate for the SAP Hana Service Layer because it will be consumed by my app internally.

The thing is, When I tested the login service via Postman its working fine & I am getting the session details as well but the same url is not working through my code so is there anything more I need to do to access the service ?

using (var client = new HttpClient())
var credentials = new { UserName = "admin", Password = "", "" };
var json = JsonConvert.SerializeObject(credentials);
var response = client.PostAsync(url),
                    new StringContent(json, Encoding.UTF8, "application/json")).Result;
if (response.IsSuccessStatusCode)
dynamic content = JsonConvert.DeserializeObject(response.Content.ReadAsStringAsync().Result);

// Access variables from the returned JSON object
var appHref = content.links.applications.href;
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers