cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We are making some updates so the Community might be down for a few hours on Monday the 11th of November. Apologies for the inconvenience and thank you for your patience. You can find out more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dropbox .Net API UploadSessionStartAsync throwing httpclient timeout exception all of the sudden

Dropbox .Net API UploadSessionStartAsync throwing httpclient timeout exception all of the sudden

rororo12
Explorer | Level 3

Hello, 

 

Our app all of the sudden is getting the following exception when trying to call UploadSessionStartAsync like so:
var result = await DropboxClientInstance.Files.UploadSessionStartAsync(body: memStream, uploadSessionStartArg:new UploadSessionStartArg());

 

Here is the exception:

The request was canceled due to the configured HttpClient.Timeout of 300 seconds elapsing.

 

The timeout was originally 100ms and I thought maybe there's some network lag so I increased the httpclient timeout to 5 mins (or 300 seconds) when initializing the Dropbox Client like so like so:

 

var dbxConfig = new DropboxClientConfig();
dbxConfig.HttpClient = new HttpClient();
dbxConfig.HttpClient.Timeout = new TimeSpan(0, 5, 0); //setting httpclient timeout to 5 mins or 300 seconds

var tokenResult = await DropboxOAuth2Helper.ProcessCodeFlowAsync(code: input, appKey: dbxAppKey, appSecret: dbxAppSecretKey, redirectUri: null);

 

DropboxClientInstance = new DropboxClient(appKey: dbxAppKey,
appSecret: dbxAppSecretKey,
oauth2AccessToken: tokenResult.AccessToken,
oauth2RefreshToken: tokenResult.RefreshToken,
oauth2AccessTokenExpiresAt: tokenResult.ExpiresAt.Value, config: dbxConfig);

 

I'm using V7 of the .net library 

 

Anyone know why all of the sudden I would be getting an httpclient timeout when it was working fine for months without an issue?

 

Thanks in advance for the help!

 

 

 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff

@rororo12 Like Здравко recommended, I suggest troubleshooting your environment to see if there's anything wrong with your network connection that would be interfering with the network requests to the Dropbox API servers. (For example, is there any proxy, firewall, etc. that may be causing an issue?) I'm not aware of an issue that should be preventing these calls from completing. I just tried out your code using v7.0.0 of the Dropbox .NET SDK and it ran successfully for me.

View solution in original post

3 Replies 3

Здравко
Legendary | Level 20

Hi @rororo12,

Can you perform arbitrary HTTP request to Dropbox server using so configured HttpClient in your code? It sounds like you have some platform issues likely came up recently; check this. Make sure you have working network connection able to perform HTTP request that successfully roots to Dropbox server in your application.

Good luck.

Greg-DB
Dropbox Staff

@rororo12 Like Здравко recommended, I suggest troubleshooting your environment to see if there's anything wrong with your network connection that would be interfering with the network requests to the Dropbox API servers. (For example, is there any proxy, firewall, etc. that may be causing an issue?) I'm not aware of an issue that should be preventing these calls from completing. I just tried out your code using v7.0.0 of the Dropbox .NET SDK and it ran successfully for me.

rororo12
Explorer | Level 3

Hi Greg and Здравко ,  a hard cycle of the server solved the problem but it's still a super strange issue because the server hadn't been touched for months and all the other apps running on it were able to communicate with the internet without a problem.  Who knows but thanks for the tip, sometimes it's just something as stupid as a reboot I guess haha.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    rororo12 Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?