dotnet / dotnet/wcf

The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch, RemoteCertificateChainErrors

Open
#4,544 4 comments 0 reactions 1 assignee Claimed by @mconnew View on GitHub
customer assistance
Dominant language
C#
Stars
1.8k
Forks
576
Avg merge
6d 9h
Merged PRs (30d)
2

Description

We are migrating our worker service from .NET 4.5 to .NET 5 (latest version).

We have created a Connected Service but when we try to Invoke method we are getting error in terms of Invalid SSL connection. In our old code we used

ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;

but that is not helping us right now. We can not use HttpClientHandler solution cause our app is Console App configured as a service and we are using Generated methods from Connected Service.

For example

TransportPortTypeClient trans = new TransportPortTypeClient(TransportPortTypeClient.EndpointConfiguration.SecureSOAP12Endpoint);

var ws_docoments = await trans.select_xxmob_dokumenti_transport_operationAsync(start_date));

Error that we are getting is "Could not establish trust relationship for the SSL/TLS secure channel with authority 'site,com:443'."

Old code (.net 4.5) and SoapUI on same machine works fine

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.