Skip to main content

Increasing web request timeout



  • Stephen Doyle

    Hi Mojtaba,

    How long is the API call taking before it times out? You may be reaching the client-side timeout for the call made by our SDK rather than a timeout on our server-side. 

    if so, you can adjust the client-side timeout by setting a higher value in teh SDK configuration:

    If you're uploading large files and those are timing out, you may also want to send the upload as a chunked upload instead of a single API call, via the UploadLarge  method:


  • Mojtaba

    Hi Stephen,

    Thanks for your reply.

    I increased the client-side timeout to 10 minutes, but after about 90 seconds I receive the following error:

    A task was canceled.

    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at CloudinaryDotNet.ApiShared.Call(HttpMethod method, String url, SortedDictionary`2 parameters, FileDescription file, Dictionary`2 extraHeaders)
    at CloudinaryDotNet.ApiShared.CallAndParse[T](HttpMethod method, String url, SortedDictionary`2 parameters, FileDescription file, Dictionary`2 extraHeaders)
    at CloudinaryDotNet.ApiShared.CallApi[T](HttpMethod method, String url, BaseParams parameters, FileDescription file, Dictionary`2 extraHeaders)
    at CloudinaryDotNet.Cloudinary.Upload[T,TP](TP parameters)
    at CloudinaryDotNet.Cloudinary.Upload(ImageUploadParams parameters)

    The file size is about 4MB. I am processing two breakpoints for this image;

    "create_derived": false,
    "bytes_step": 15000,
    "max_images": 20,
    "min_width": 320,
    "max_width": 5000


    "create_derived": false,
    "bytes_step": 15000,
    "max_images": 22,
    "min_width": 128,
    "max_width": 2304,
    "transformation": "ar_3:2,c_fill,g_auto:subject"

    When I process the breakpoints in two separate requests it works with no problem. Any idea where the issue might be?




  • Stephen Doyle

    That still looks like a timeout somewhere in your code - 

    Certainly, it shouldn't take 90 seconds to upload an image and request the breakpoint generation unless the internet connection is very slow, and uploading the file itself is taking a long time. If you make the upload "async" does it work?

    Note that if the upload is async, the response you get won't include the breakpoints or any other information about the uploaded file but it means that the processing takes place in the background which may help you to see where the delay is. 

  • Mojtaba

    My internet is quite fast, and I am processing some other images even with a bigger size with no problem. Please note that this issue only occurs for certain images.

    As I said if I process responsive breakpoints in two separate requests it works. So, I guess the problem is not in uploading the file but rather in processing those two responsive breakpoints together (probably in your end).

    I did try UploadAsync and got the same error i.e., "a task was canceled".

  • Daniel Mendoza

    Can you please open a ticket here ( so we can get more customer-specific details about your request? Please include your cloud name in the ticket.


Post is closed for comments.