Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use TLS 1.2 in TFS Webhooks

Tags:

ssl

tfs

tls1.2

I'm trying to setup a Webhook in TFS to target an internal HTTPS server. I'm getting this error when I attempt to test the url:

System.Net.Http.HttpRequestException: An error occurred while sending the request.
---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Services.ServiceHooks.Common.HttpActionTask.

The Could not create SSL/TLS secure channel error happens because TFS uses TLS 1.0 to open the connection to the remote server, and that server only accepts TLS 1.2 requests.

How can we configure the Webhook to use TLS 1.2?

like image 603
ndeslandes Avatar asked Nov 22 '25 15:11

ndeslandes


1 Answers

try this before make the request:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

Hope it helps

like image 195
federico scamuzzi Avatar answered Nov 25 '25 06:11

federico scamuzzi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!