How do I attach an SSL certificate to access SOAP services with .NET Framework 4.8?

Avinash Singh 0 Reputation points
2024-02-15T14:43:26.2333333+00:00

Hello everyone, We have a requirement to attach the SSL certificate while consuming SOAP services. We are getting an error as "Could not establish secure channel for SSL/TLS with authority 'url.com:portnumber'/". Inner Exception WebException: The request was aborted: Could not create SSL/TLS secure channel when we try to attach it using .net framework 4.8, However, we can make the connection with the same URL and same certificate using .Net core 6.0. After further research, we found that the certificate is attached with .NetFramework 4.8 but it's not reaching the SOAP service. Is there any such limitation with .Net framework 4.8 or is there any different way of attaching the SSL certificate using .net framework 4.8? I am using the sample code below to attach the SSL cert, System. Net. ServicePointManager.SecurityProtocol = System.Net. SecurityProtocolType. Tls12; InqSvc_v1_0Client serviceClient = new InqSvc_v1_0Client("SOAPURL"); serviceClient.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName. Root, X509FindType.FindBySerialNumber, "SSL_CertSerialNumber"); res.InqRs = serviceClient.Inq(ss); Any help will be greatly appreciated!

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,509 questions
ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
343 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.