'Could not establish secure channel for SSL/TLS with authority in .net 5
I am getting this error only with the application developed in .net 5.0,. For .net 4.5* application it is working fine. With .net 5.0 console application when calling WCF service getting SSl/TLS issue. Already tried below code but not working:
ServicePointManager.ServerCertificateValidationCallback += ValidateServerCertficate;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
ServicePointManager.Expect100Continue = true;
I have written this lines in Main function before creating the host:
Host.CreateDefaultBuilder(args)
Complete error is as below: Could not establish trust relationship for the SSL/TLS secure channel with authority
Binding Used for WCF call is as below:
var binding = new BasicHttpsBinding
{
CloseTimeout = new TimeSpan(0, 1, 0),
OpenTimeout = new TimeSpan(0, 1, 0),
ReceiveTimeout = new TimeSpan(0, 1, 0),
SendTimeout = new TimeSpan(0, 1, 0),
MaxBufferPoolSize = 2147483647,
MaxBufferSize = 2147483647,
MaxReceivedMessageSize = 2147483647,
TransferMode = TransferMode.Buffered,
UseDefaultWebProxy = true,
AllowCookies = false,
MessageEncoding = WSMessageEncoding.Mtom,
Name = "dlBinding",
BypassProxyOnLocal = false,
Security =
{
Mode = BasicHttpsSecurityMode.TransportWithMessageCredential,
Transport = new HttpTransportSecurity
{
ClientCredentialType = HttpClientCredentialType.Certificate,
ProxyCredentialType = HttpProxyCredentialType.Basic,
}
}
};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
