I have the tool which consumes a web service. I have generated a self signed cert for the web service, exported it using certificate manager to a local path.
I'm following the following msdn code to add the certificate into by webservice. https://support.microsoft.com/en-us/kb/901183
string certPath = @"C:\TestData\certificate.cer";
test.ClientCertificates.Add(X509Certificate.CreateFromCertFile(certPath));
Above is my code.
I'm getting the following error.
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
Stack trace:
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at web_Client.testClient.testClassWebService.Add(Request request) in C:\Workspace\Reference.cs:line 248
at web_Client.WebClient.Add() in C:\Workspace\WebClient.cs:line 227
I have no idea what's going on. I'm very new to web and certificates. Please help.