Stijn
Stijn

Reputation: 21

Sharepoint : The underlying connection was closed: An unexpected error occurred on a send. but not al the time

I am trying to upload files to sharepoint with a uploadsession, https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0 It works -i create the uploadsession - and with the received url i upload the file. but it only works some minutes in a hour. Creating and receiving the data for the uploadsession is no problem but uploading the file i get for the most time the error: The underlying connection was closed: An unexpected error occurred on a send.

StackTrace: 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. -

I dont think its TLS1.2 related because it sometimes works?

Upvotes: 1

Views: 3165

Answers (1)

Michael Han
Michael Han

Reputation: 3655

It could be TLS1.2 related. The similar issue was discussed here: https://github.com/pnp/pnpframework/issues/336. Windows 2012 R2 and worked intermittently.

Make sure the server supports one of supported cyphers:

  1. TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
  2. TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
  3. TLS_DHE_RSA_WITH_AES_256_GCM_SHA38
  4. TLS_DHE_RSA_WITH_AES_128_GCM_SHA256

Upvotes: 0

Related Questions