0

So We have windows service api that gets data then send to web using webclient the problem is we have this certain branch that sends error while other branches api are working fine except for this one branch that sends error:

"The request was aborted: Could not create SSL/TLS secure channel"

i have added

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

yet the error still occured , please help and thankyou

heres the code

Athanasios Kataras
  • 25,191
  • 4
  • 32
  • 61
Gowther
  • 23
  • 6

1 Answers1

0

I'm guessing you already followed the top voted here: The request was aborted: Could not create SSL/TLS secure channel

Try to extend you tls protocols like this, so that it can fallback to previous versions if the server does not support them:

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
               | SecurityProtocolType.Tls11
               | SecurityProtocolType.Tls12
               | SecurityProtocolType.Ssl3;

If it doesn't work still, try the answer by User:APW with extra troubleshooting steps.

Athanasios Kataras
  • 25,191
  • 4
  • 32
  • 61