使用SaveBinaryDirect上载sharepoint文档异常

使用SaveBinaryDirect上载sharepoint文档异常,sharepoint,sharepoint-2010,sharepoint-clientobject,Sharepoint,Sharepoint 2010,Sharepoint Clientobject,我有一个Windows应用程序,可以将.pdfs保存到SharePoint文档库。除了这个文件外,它工作正常。每当我对这个10.1MB文件使用SaveBinaryDirect时,都会出现以下异常: System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read

我有一个Windows应用程序,可以将.pdfs保存到SharePoint文档库。除了这个文件外,它工作正常。每当我对这个10.1MB文件使用SaveBinaryDirect时,都会出现以下异常:

System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
   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.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute()
   at Microsoft.SharePoint.Client.File.SaveBinary(ClientContext context, String serverRelativeUrl, Stream stream, String etag, Boolean overwriteIfExists, SaveBinaryCheckMode checkMode)
   at Microsoft.SharePoint.Client.File.SaveBinaryDirect(ClientContext context, String serverRelativeUrl, Stream stream, Boolean overwriteIfExists)
   at BKWatch.BKWatchViewModel.UploadDocument(String siteURL, String documentListName, String documentListURL, String documentName, Byte[] documentStream, Int64 AccountId, String DebtorName, Nullable`1 Pages, String Title) 
我已经尝试了以下方法:

clientContext.PendingRequest.RequestExecutor.WebRequest.KeepAlive = false;

System.Net.ServicePointManager.MaxServicePointIdleTime = 600000;
 clientContext.RequestTimeout = 600000;
正在增加SharePoint中的最大大小-已达到50 MB 正在增加IIS web.config中的最大大小-已达到2GB


谢谢。

在与Microsoft进行了几次长时间的电话交谈后,他们认为SaveBinaryDirect代码中存在错误,建议我使用ClientObject。请添加功能。到目前为止似乎仍在工作。

我在连续上载多个大文件时遇到了Microsoft.SharePoint.Client.File.SaveBinaryDirect的此问题

每次使用SaveBinaryDirect时,都会使用try-catch和catch-System.Net.WebException对其进行修复


一旦捕获到Webexception,请运行与以前运行的相同的SaveBinaryDirect命令,它应该可以工作。

为什么要投反对票?我是新来的,所以我想知道如何改进这个问题。有趣的问题是,我也在使用控制台应用程序进行类似的文件迁移。在这里,我将SP2013与CSOM一起使用。使用“Folder.Files.Add(mydoc);”。我得到的例外,即使是超过10MB的文件。我正在考虑增加IIS中站点的“Ping最大响应时间”间隔。增加SharePoint&web.config中的最大大小是什么意思?