1

Exception : The requested security protocol is not supported c#.

My application is using .net framework 3.5 and run on server windows 2016. After i started getting exception "The underlying connection was closed: An unexpected error occurred on a send." I changed my code and defined the protocol security as below-

            Const _Tls12 As SslProtocols = DirectCast(&HC00, SslProtocols)
            Const Tls12 As SecurityProtocolType = DirectCast(_Tls12, SecurityProtocolType)
            ServicePointManager.SecurityProtocol = Tls12

After changing my code at my local environment started working but still have issue at Live server.

"The requested security protocol is not supported."

I have already defined the possible security protocol but still the same code is not working for Live.

Also, due to limitations of the version we are using, we cannot upgrade the Framework at this time.

Please suggest.

Gaurav Aote
  • 51
  • 2
  • 11
  • https://support.microsoft.com/en-us/help/3154518/support-for-tls-system-default-versions-included-in-the-net-framework ? not sure if that applies to Server 2016 - see also: https://stackoverflow.com/q/43240611/23354 – Marc Gravell Jan 16 '20 at 14:41
  • Gonna have to downgrade the security and allow 1.1 certificates. tls1.2 didn't exist back in 3.5, and sadly, the enum value has to exist for it to be used. – Davesoft Jan 17 '20 at 16:02
  • @Davesoft Use this instead of enum > ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; https://blogs.perficient.com/2016/04/28/tsl-1-2-and-net-support/ – kadir950 Jun 22 '20 at 12:17

0 Answers0