0

I have to call web service available at external IP like https://XX.XX.XX.XX:XXXXX in my console application for development purpose. While calling service from C# code, its giving error- “The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.”

The client exposing service will provide SSL certificate for production server. Currently I have to create SSL certificate which will remove errors for development purpose. I don't want to write the code to ignore certificate errors or to trust relation.

I fount many articles about creating certificate with server domain name. But when i replace my server IP address for domain name. it's not working. Is there any way to create SSL for server with its IP address?

Also how to use that certificate with console application to get service response?

Ketaki
  • 1
  • 2
  • How to you access the web resource? Would be nice if you could show some code ;). – JanDotNet Oct 05 '17 at 14:50
  • I suppose that could help you: [How to ignore a certificate error with c# 2.0 WebClient - without the certificate](https://stackoverflow.com/questions/1301127/how-to-ignore-a-certificate-error-with-c-sharp-2-0-webclient-without-the-certi) – JanDotNet Oct 05 '17 at 14:51
  • you don't use certificate from console app. The web service that you are using, as hosted on the IIS, should be binded with that certificate and added to trusted root – Souvik Ghosh Oct 05 '17 at 14:52
  • actually https certificate has to be created in special way. check [makecert documentation for details](https://msdn.microsoft.com/en-us/library/bfsktky3(VS.100).aspx). But certificate name has to contain hostname `Makecert –r –pe –n CN="www.example.com"` so you have to consider this when IP address is used – oleksa Oct 05 '17 at 14:54

0 Answers0