Hi all,
for some reason, my keepAlive API stopped working and I have no idea why. It happened yesterday and I just keep getting "The request was aborted: Could not create SSL/TLS secure channel." error message. Please see my code and screenshot of the error below:
public static KeepAliveResponse KeepAlive(string ssoid) { var keepAlive = new KeepAliveResponse(); keepAlive.status = KeepAliveStatus.FAIL.ToString(); keepAlive.error = KeepAliveError.INTERNAL_ERROR.ToString(); try { var request = (HttpWebRequest)WebRequest.Create("https://identitysso.betfair.com/api/keepAlive"); request.Accept = "application/json"; request.Method = "POST"; request.Headers.Add(HttpRequestHeader.AcceptCharse t, "ISO-8859-1,utf-8"); request.Headers.Add("X-Authentication: " + ssoid); request.Headers.Add("X-Application: " + LiveKey); using (var stream = ((HttpWebResponse)request.GetResponse()).GetRespon seStream()) { using (var reader = new StreamReader(stream, Encoding.Default)) { keepAlive = JsonConvert.DeserializeObject<KeepAliveResponse>(r eader.ReadToEnd()); } } return keepAlive; } catch(Exception e) { return keepAlive; } }
https://imgur.com/a/sSKYAXV
All other APIs like login, getMarketCatalogue, placeBet,etc. work perfectly fine. Anyone has an idea what is going on and what might go wrong?
Update: I figured out where was the issue. Apprerantelly now I need to add the following lines to my code
ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
for some reason, my keepAlive API stopped working and I have no idea why. It happened yesterday and I just keep getting "The request was aborted: Could not create SSL/TLS secure channel." error message. Please see my code and screenshot of the error below:
public static KeepAliveResponse KeepAlive(string ssoid) { var keepAlive = new KeepAliveResponse(); keepAlive.status = KeepAliveStatus.FAIL.ToString(); keepAlive.error = KeepAliveError.INTERNAL_ERROR.ToString(); try { var request = (HttpWebRequest)WebRequest.Create("https://identitysso.betfair.com/api/keepAlive"); request.Accept = "application/json"; request.Method = "POST"; request.Headers.Add(HttpRequestHeader.AcceptCharse t, "ISO-8859-1,utf-8"); request.Headers.Add("X-Authentication: " + ssoid); request.Headers.Add("X-Application: " + LiveKey); using (var stream = ((HttpWebResponse)request.GetResponse()).GetRespon seStream()) { using (var reader = new StreamReader(stream, Encoding.Default)) { keepAlive = JsonConvert.DeserializeObject<KeepAliveResponse>(r eader.ReadToEnd()); } } return keepAlive; } catch(Exception e) { return keepAlive; } }
https://imgur.com/a/sSKYAXV
All other APIs like login, getMarketCatalogue, placeBet,etc. work perfectly fine. Anyone has an idea what is going on and what might go wrong?
Update: I figured out where was the issue. Apprerantelly now I need to add the following lines to my code
ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

