I have deveoped asp.net web application and running it using iisexpress in local. I want to call webservice which require two wayssl.
I have client certificate, installed in my local machine, given full control to Network_service, loggedin user using certificate mmc.
Calling service using following code
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12
| SecurityProtocolType.Ssl3;
HttpWebRequest request = WebRequest.Create(new Uri(_endPoint)) as HttpWebRequest;
// Set type to POST
request.Method = "GET";
request.ContentType = "application/xml";
_endPoint = _endPoint + "?callerFID='" + _callerFID + "'&callerID='" + _callerID;
X509Certificate2 cert = new X509Certificate2("C:\\test.p12", "TEST");
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate(Object obj, X509Certificate X509certificate, X509Chain chain, System.Net.Security.SslPolicyErrors errors)
{
return true;
};
request.ClientCertificates.Add(cert);
request.PreAuthenticate = true;
try
{
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
string result = reader.ReadToEnd();
reader.Close();
}
return new IMSUserManagementService.UserManagerV2Client(_endPoint);
}
catch (Exception)
{
throw;
}
But Getting exception: The request was aborted: Could not create SSL/TLS secure channel
Please help me to solve the issue