Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
gagsbh
5 years agoHelpful | Level 5
Dropbox API Upload Errors using .NET SDK
Hello Greg-DB,
We already have a Dropbox solution on production system that fetches and restore files.
Our solution uses Dropbox API SDK for .NET - https://github.com/dropbox/dropbox-sdk-dotn...
- 5 years ago
All Dropbox API calls use HTTPS, so they go to port 443 on the relevant Dropbox API servers, which, for uploading and downloading file content via the official .NET SDK, is content.dropboxapi.com.
As for the error you're getting, can you let me know what version number of the SDK you have installed, and share the relevant code snippet that's running when you see this? Thanks in advance!
Greg-DB
Dropbox Community Moderator
5 years agoThanks for the additional information. That doesn't look like the particular version information I was looking for though. Can you share the version number of the Dropbox SDK itself, e.g., as you installed via NuGet, for instance? The latest version is currently v6.6.2.
Also, looking at the stack it looks like you are not on the latest version, so I recommend upgrading to that anyway, in case this issue is already resolved in the latest version.
Anyway, I'm trying to reproduce this but I can't seem to. It works correctly for me, even after repeating the upload call many times, so please let me know if the upgrade helps.
gagsbh
5 years agoHelpful | Level 5
Hello Greg-DB
Thank-you for the information.
I upgraded the Dropbox API to v 6.6.2 and converted all my .NET projects to target .Net Framework 4.7.2.
The uploads were working fine yesterday and today morning but since last couple of hours I started getting the following exception during uploads.
The exception is thrown at this line in our Business logic code.
fileMetadata = await client.Files.UploadAsync(remotePath, mode: WriteMode.Overwrite.Instance, autorename: false, body: stream);
Please see exception stack trace below:
An error occurred while sending the request.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Dropbox.Api.DropboxRequestHandler.<RequestJsonString>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Dropbox.Api.DropboxRequestHandler.<RequestJsonStringWithRetry>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Dropbox.Api.DropboxRequestHandler.<Dropbox-Api-Stone-ITransport-SendUploadRequestAsync>d__13`3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Dropbox.Business.DropboxApi.<Upload>d__53.MoveNext() in C:\Dropbox\Business\DropboxApi.cs:line 1703
The files being uploaded were 404 KB each in size.
This might be an issue local to our server or network.
What do we need to check at our end to find if this is our local issue ?
For larger files we use UploadSessionStartAsync for file uploads.
With the new Dropbox API v6.6.2, UploadSessionStartAsync takes UploadSessionType as argument.
UploadSessionType can be Sequential, Concurrent or Other.
Which value should we choose for UploadSessionType and when ?
Can you please help us again.
Thanks,
Gagan
- Greg-DB5 years ago
Dropbox Community Moderator
Thanks for upgrading and letting me know.
Can you confirm if this is the full output you're getting now though? It seems to be a different kind of issue than seen in your original post. (For instance, it no longer says "Object reference not set to an instance of an object" or the GetRequestId method.)
Anyway, since it is not occurring for me, and I don't believe we've received other reports of an issue like this, it may be related to your particular environment. Is there anything on your network connection, such as a firewall, proxy, etc. that may be interfering with your connection to content.dropboxapi.com?
Also, "Sequential" is the default for UploadSessionType, so you should be using that unless you've specifically implemented the "Concurrent" type. (The "Concurrent" type is a new feature that allows you to upload multiple pieces of a file for a particular upload session in parallel.)
- gagsbh5 years agoHelpful | Level 5
Hello Greg-DB
This is the full output and it is the same issue.
Exception in old Dropbox API version was not handled properly and control went till GetRequestID where object was null because response headers were missing. The exception message and stack trace changed after the Dropbox API was upgraded to 6.6.2.
As per your suggestion, I have asked my technical admin to check the environment.
I will let you know if we figure out any local issue.
Thanks,
Gagan
- gagsbh5 years agoHelpful | Level 5
Hello Greg-DB
The uploads worked on one of our servers but failed on 3 other servers.
The upload also worked on my local development machine.
I monitored the failed requests on the 3 servers using Fiddler and got the following in the response:
"HTTPS handshake to content.dropboxapi.com (for #18) failed. System.IO.IOException Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. < An existing connection was forcibly closed by the remote host"
I did a trace route on one of the servers where upload failed using the following command:
C:\Windows\system32>tracert content.dropboxapi.comTracing route to edge-block-api-env.dropbox-dns.com [162.125.11.14]
over a maximum of 30 hops:1 11 ms 11 ms 12 ms 10.7.151.253
2 12 ms 12 ms 19 ms 107.6.3.58
3 39 ms 100 ms 13 ms et-1-1-5.tor-fr709-cor-1.peer1.net [216.187.113.177]
4 4 ms 5 ms 4 ms dropbox.ip4.torontointernetxchange.net [206.108.35.99]
5 21 ms 17 ms 20 ms po1-yyz1-ea01.net.dropbox.com [162.125.10.33]
6 12 ms 13 ms 11 ms 162.125.11.14Trace complete.
We are checking if our hosting provider is blocking content.dropboxapi.com
Can it be possible if Dropbox is blocking requests originating from our 3 servers where uploads are failing.
If yes, how do we confirm this.
Thanks,
Gagan
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!