We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

rororo12's avatar
rororo12
Explorer | Level 3
5 months ago

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

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!

 

 

 

  • 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.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox 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's avatar
      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.

  • Здравко's avatar
    Здравко
    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.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,878 PostsLatest Activity: 2 hours ago
326 Following

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 or Facebook.

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!