I am trying to connect the service file(.svc). from my c# code but i am getting message as
The request was aborted: Could not create SSL/TLS secure channel
The server accept only below Cipher code
The ciphers accepted are as per below:
TLSv1.2 128 bits ECDHE-RSA-AES128-GCM-SHA256 Curve P-256 DHE 256
TLSv1.2 256 bits ECDHE-RSA-AES256-GCM-SHA384 Curve P-256 DHE 256
Code:
string str = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">";
str = str + "<soapenv:Header/>";
str = str + "<soapenv:Body>";
str = str + "<tem:Logon>";
str = str + "<tem:logonRequest>";
str = str + "<tem:Username>XXXXXXX</tem:Username>";
str = str + "<tem:Password>XXXXXXX</tem:Password>";
str = str + "</tem:logonRequest>";
str = str + "</tem:Logon>";
str = str + "</soapenv:Body>";
str = str + "</soapenv:Envelope>";
Code:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });
var client = new RestClient(url);
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/xml");
request.AddParameter("undefined", str, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Tried the solutions as below
1) Added below line for TLS1.2 enable
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });
Thanks and Regards