Код: Выделить всё
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => true;
var binding = new BasicHttpBinding()
{
SendTimeout = TimeSpan.FromMinutes(10),
MaxReceivedMessageSize = Int32.MaxValue,
};
binding.Security.Mode = BasicHttpSecurityMode.Transport;
using (var client = new SampleService(binding, new EndpointAddress("https://localhost/SampleService/Service.svc")))
{
var response = client.GetConfiguration();
}
Не удалось установить доверительные отношения для безопасного канала SSL/TLS с полномочиями «localhost».
Похоже на этот делегат:
Код: Выделить всё
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => true;
Код: Выделить всё
using (var client = new SampleService(binding, new EndpointAddress("https://localhost/SampleService/Service.svc")))
{
client.ClientCredentials.ServiceCertificate.SslCertificateAuthentication = new System.ServiceModel.Security.X509ServiceCertificateAuthentication()
{
CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None,
RevocationMode = System.Security.Cryptography.X509Certificates.X509RevocationMode.NoCheck
};
var response = client.GetConfiguration();
}
Подробнее здесь: https://stackoverflow.com/questions/786 ... -a-net-6-0