My issue is about DirectLine sample code of BotBuilder SDK for .NET, which is located at:
Samples/blob/master/core-DirectLineWebSockets/DirectLineClient
When I use above code to create a WebSocket to connect DirectLine I always get below error:
WebSocketSharp.WebSocketException: An error has occurred during a TLS handshake. ---> System.NotSupportedException: The requested security protocol is not supported.
at System.Net.SecurityProtocol.ThrowOnNotAllowed(SslProtocols protocols, Boolean allowNone)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
at WebSocketSharp.WebSocket.setClientStream()
--- End of inner exception stack trace ---
at WebSocketSharp.WebSocket.setClientStream()
at WebSocketSharp.WebSocket.doHandshake()
at WebSocketSharp.WebSocket.connect()
Actually, the root cause is web server of DirectLine service forced TLS v1.2 but WebSocketSharp doesn't specified yet.
Add below line after created WebSocketSharp.WebSocket object:
// You have to specify TLS version to 1.2 or connection will be failed in handshake.
WebSocketClient.SslConfiguration.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12;
Would you like to submit a PR to add this code to the sample?
OK, I will do it soon.
Let's make sure we take the PR in the v3 branch
@EricDahlvang, to get the PR ready.
Closing since this was apparently already merged: https://github.com/Microsoft/BotBuilder-Samples/pull/281
Most helpful comment
OK, I will do it soon.