I'm trying to create some test transactions on sandbox. I have IIS 10.0 express and .net 4.6 and i got the error saying that the existing connection was forcibly closed by the remote host. Do we have to do any code changes to fix this?
07-19-2017 08:01 AM
Try adding the following at the beginning of the function where you make a webrequest:
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
07-19-2017 08:31 AM
Sorry this did not help.
07-19-2017 09:40 AM
07-19-2017 09:48 AM
I think it is targeting 4.0. I cannot use SecurityProtocolType.Tls12 and SecurityProtocolType.Tls11. I can only use SecurityProtocolType.Tls and which is TLS 1.0 so it cannot connect
07-19-2017 10:29 AM
Target >net Framework 4.5
07-19-2017 10:42 AM
07-19-2017 10:56 AM
It got fixed with this code
const SslProtocols _Tls12 = (SslProtocols)0x00000C00;
const SecurityProtocolType Tls12 = (SecurityProtocolType)_Tls12;
ServicePointManager.SecurityProtocol = Tls12;
07-19-2017 11:56 AM