I am working on a .net application which is migrated from 4.5.2 to 4.7.2 .net framework. After the migration I was testing my app for only TLS1.2 connectivity and the application breaks while downloading some images with https protocol. if I enable Tls1.2 and SSL3 both then application works as expected. We are testing the application functionality based on only TLS 1.2 and rest all the protocols SSL2, SSL2, TLS1.0, TLS 1.1 i have disabled using IIS Crypto dll. I have made below changes in the config file of my Windows app still if is throwing below attached error …
<appcontextswitchoverrides value="Switch.System.Net.DontEnableSystemDefaultTlsVersions=false">
<supportedruntime version="v4.0" sku=".NETFramework,Version=v4.7.2">
Error:
There was a problem downloading the image file: https:/v4_6_Release/common/images/buttons/save.png
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. —> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. —> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
— End of inner exception stack trace —
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.TlsStream.CallProcessAuthentication(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.ConnectStream.WriteHeaders(Boolean async)
— End of inner exception stack trace —
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
at System.Net.WebClient.DownloadData(Uri address)
at System.Net.WebClient.DownloadData(String address)
at ABC.FileDownloader.DownloadBinaryFile(String url, String username, String password)
at ABC.FileDownloader.DownloadBinaryFile(String url)
at ABC.ButtonBar.GetImageFromFile(String name)
Can anyone please assist here ….
What I have tried:
<appcontextswitchoverrides value="Switch.System.Net.DontEnableSystemDefaultTlsVersions=false">
<supportedruntime version="v4.0" sku=".NETFramework,Version=v4.7.2">