Reputation: 336
I am having issue with box-sdk (https://github.com/box/box-windows-sdk-v2) upload API. Issue : When try to upload large file (more than 3MB) (file less than 3mb works great.) Upload api fails and throws below exception.
Error :
ToString : System.AggregateException: One or more errors occurred. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled. --- End of inner exception stack trace --- at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at XXXX.Program.d__34.MoveNext() in d:\Gaurav\TFS\XXXX\XXXX\Program.cs:line 319 ---> (Inner Exception #0) System.Threading.Tasks.TaskCanceledException: A task was canceled.<---
StackTrace :
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at XXXX.Program.d__34.MoveNext() in d:\Gaurav\TFS\XXXX\XXXX\Program.cs:line 319
InnerException : System.Threading.Tasks.TaskCanceledException: A task was canceled. TIME : 2014-05-28 04:55:59 PM
Code that is generating error :
using (Task<BoxFile> uploadTask = boxClient.FilesManager.UploadAsync(boxFileRequest, spStream))
{
BoxFile newFile = uploadTask.Result;
}
Upvotes: 2
Views: 1322
Reputation: 137
Try to use timeout parameter in UploadAsync method:
boxFile = Client.FilesManager.UploadAsync(req, fs, null, new TimeSpan(1, 0, 0)).Result;
Upvotes: 3