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?
try this before make the request:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Hope it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With