I am experiencing the following error, when doing translations:
The underlying connection was closed: An unexpected error occurred on a send
This has happened suddenly without any change by my side of the script configuration.
I also can read in Resource Integrity: Not possible to determine the status of integrity of the resource Cognitive Services at the moment.
I am wondering if this relates to a known Microsoft Azure issue or if I should do any fix on my side.
Thank you
I I have tried adding the below ones but still I'm getting the same error. I have tried adding at the beginning / Just the line before ExecuteQuery() but no luck. I'm invoking the SharePoint Online using the ClientContext. I'm using .NET framework 4.7.2. Let me know if I'm missing something?
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12;
After MS support pointed us in the direction of TLS, adding the following line fixed the error for us:
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
Still don't understand why after years of working fine today was the day it needed to be changed.
Edit: While the above definitely fixed the error, the line we ended up using was:
System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12;
The resource to authenticate is Global.
The error happens when calling the following API:
https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&from=it&to=DE&to=EN&to=FR&to=ES&to=NL
and precisely when calling this method: System.Net.HttpWebRequest.GetResponse()
“Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host”
Stack Trace: in System.Net.HttpWebRequest.GetResponse()
Inner exception:
in System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
in System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
Error code: 10054
SocketErrorCode: ConnectionReset {10054} System.Net.Sockets.SocketError
Thank you Stephen, I had to adapt this fix to .net framework, but it worked also!
Thank you very much for sharing.
I agree I can't believe they suddenly have deprecated previous TLS versions, without any warning...
hey stephen.
i think i am missing a small piece of the puzzle :) so if this is a stupid question bear with me
where did you add this line.
in the application or in the api call.
Since this was a production hotfix for us, we added the line right before creating the request object that was failing.
If this was something we had time to fix, we would've applied it at application/service start up instead.
Did you find a way to solve this ? I have the same problem in Power BI and Power Query in Excel, I can't connect to any data source that requires an authentification to my professional account, I get the error "The underlying connection was closed". It also occurs when I try to update datas in my older files that used to work perfectly ...