Communication between Applications using Httpclient with SSL error

Asked

Viewed 16 times

0

I have an IIS 10 server with two applications developed by the company.

The first, older, is an MVC developed in . Net Framework 4.5.

The second, newer, is an API developed in . Net Core 3.1.

In MVC, we consume the API. In development and Homologation works perfectly, without SSL.

But in the production environment, we configure the applications with their own Certificates. MVC has his and the API has hers.

The problem is that the communication, using Httpclient(), has given the following error:

Could not Establish trust Relationship for the SSL/TLS Secure Channel

1 - I tried to solve like this, but it didn’t work:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

2 - I tried to solve like this, it worked for a while and then returned to the error presented above:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

3 - I tried to solve so, it also worked for a while and then returned to give the error presented above:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

inserir a descrição da imagem aqui

  • 1

    You need to take the error and see what the problem is, Authority, expired certificate, not found, etc... da para fazer um "bypass" usando ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;, that is, a delegate to say that everything is ok, returning true. Obs, I think you already know this, but even if it’s clear in the image, code is always better than picture in question ;)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.