I am suddenly getting the error above on my winhost app. It just started Monday night (10/12) or Tuesday morning (10/13). I am trying to grab data from another site. It was working previously for quite a long time. No changes were made by me. (Some were made just now to try to fix it). The relevant function works on my personal test machine, just not up on the winhost site. I'm just a retired hobbyist programmer, so I don't know much about network communications, but at some point I did add the following two lines to the appropriate code: ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; The app throws the error on the next line of my code: bWebData = wc.DownloadData(sURL); If anyone has any ideas what happened and how I can attempt to fix it, I greatly appreciate it!
The error is generic and there are many reasons why the SSL/TLS negotiation may fail. ServicePointManager.SecurityProtocol property selects the version of the Secure Sockets Layer (SSL) or Transport Layer Security (TLS) protocol to use for new connections; existing c# socket connections aren't changed. Make sure the ServicePointManager settings are made before the HttpWebRequest is created, else it will not work. Also, you have to enable other security protocol versions to resolve this issue: ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 SecurityProtocolType.Tls SecurityProtocolType.Tls11 SecurityProtocolType.Ssl3; //createing HttpWebRequest after ServicePointManager settings HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://google.com/api/") If you create HttpWebRequest before the ServicePointManager settings it will fail and shows the error message.