question

JobyGeorge-7218 avatar image
0 Votes"
JobyGeorge-7218 asked MichaelHan-MSFT edited

Sharepoint online client - Unable to read data from the transport connection: An exi sting connection was forcibly closed by the remote host.

Hi All,

I was trying to download the SharePoint files using a .NET console application with the help of Microsoft SharePoint online client. it was working fine in my windows 8 laptop & Windows 2008 r2 sp1 server until last week. from 28/06/2021 it stopped working from the server. I am getting the following error while connecting to the SharePoint using my application.

I am using a .NET 4.5 console application with SharePoint client DLL version 16.1.0.0. Could you please do some help to resolve this issue.

PS:- I was able to browse the SharePoint site in that server using the web browser without any issues and I am using the following code to force TLS 1.2 in the code.

         ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

The error I am getting is as below.

System.IO.IOException: Unable to read data from the transport connection: An exi
sting 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.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 s
ize)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 s
ize)
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 c
ount)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocol
Request asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToke
n message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byt
e[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyRes
ult)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionCo
ntext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
ontextCallback 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)


Thanks
Joby

office-sharepoint-onlinesharepoint-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered MichaelHan-MSFT commented

Hi @JobyGeorge-7218,

Please refer to this article: https://docs.microsoft.com/en-us/sharepoint/troubleshoot/administration/authentication-errors-tls12-support


The similar issue was asked here: https://docs.microsoft.com/en-us/answers/questions/401398/sharepoint-add-in-failure-to-acquire-app-only-toke.html?childToView=406335#answer-406335

This could be related with TLS 1.2, you could refer to this article for more: https://techcommunity.microsoft.com/t5/microsoft-sharepoint-blog/provider-hosted-app-pha-application-errors-tls-errors-and-401/ba-p/2273611

104475-image.png

You could refer to this post to add the supported cyphers for TLS 1.2: https://github.com/pnp/pnpframework/issues/336


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @JobyGeorge-7218,
How are things going? Is there any update on your issue?
I am willing to hear from you.

0 Votes 0 ·