Forum Discussion
mbalcarek
Oct 07, 2021Copper Contributor
Intermittent - An existing connection was forcibly closed by the remote host - ExecuteQuery()
Hello, I have run the following code against our SharePoint Online, from several servers and local PCs and I get an intermittent error. It works on a server for a while, and then fails on the same s...
rorysullivan
Mar 10, 2022Copper Contributor
Hi mbalcarek,
We experienced a very similar issue recently. We are using the Exchange Online Webservice instead of SharePoint, but otherwise the issue was identical; intermittently getting the "connection forcibly closed' exception.
We solved the issue by updating the .NET Framework version that our app was targeting. In our case going from .NET Framework 4.5.1 to .NET Framework 4.8.
As of yet we have not established exactly why this works but our support technicians believe it is down to the TLS version that is being used to communicate with the server. .NET Framework 4.7 introduces some updates to how TLS is handled that we believe solves the issue.