locked
Increase Http Request Timeout? RRS feed

  • Question

  • Hi all,

    Is any one have any idea to increase http request timeout. i am searching since last 1month. no solution found. i have tried httpclient, httpwebrequest, RestClient(internally httpwebrequest). nothing solved my problem. i have a one post service, where i need to wait 3 mins for response. from any of above requests are not worked. is there any way to increase timeout, or something like waiting until response received. or like any retries will work. i will try all your ideas. please post your ideas.

    If you post any idea, that will help me a lot. thanks.


    Pallam Madhukar Windows Phone Developer

    Wednesday, December 25, 2013 12:31 AM

All replies

  • It is not possible to increase the timeout of classes that use the managed http stack.

    What is your scenario which requires longer wait time? 


    -Eric.

    Friday, December 27, 2013 7:42 PM
  • I thought the PCL httpClient allowed you to change the timeout?

    http://pauliom.wordpress.com

    Saturday, December 28, 2013 12:20 AM
  • You can set the timeout and the managed layer will setup a watchdog timer but the managed layer does not pass receive timeout down to the native layer so the native layer uses the default receive timeout. 

    If you set a timeout shorter than the default WinInet timeout then everything works as expected.  If the request takes longer than the timeout the managed layer will cancel the request and raise a timeout WebException.

    However, if you set a timeout longer than the default WinInet timeout, and the server does not respond in that time, then the requests will be canceled at the native layer and it will signal an error back to the managed layer. 


    -Eric.

    Monday, December 30, 2013 3:46 PM
  • Hi Eric, My service will give response within  15sec(Minmum) to 3mins(Maximum). Please can you help here to set 3mins timeout for my request. any sample that would help me more. I am familiar with C# and C++/CX. Please help me. 

    thanks.


    Pallam Madhukar Windows Phone Developer

    Tuesday, December 31, 2013 2:43 PM
  •   The Socket API's, from the supported Win32 APIs for native code, may allow you to set the receive timeout but this would require writing your own HTTP stack.

      The native API IXMLHTTPRequest2 includes an option for setting timeouts (SetProperty with XHR_PROP_TIMEOUT) but I have not verified if that works.

      Peter Torr posted a sample which includes examples of using IXMLHTTPRequest2 here: http://code.msdn.microsoft.com/wpapps/HTTP-and-Socket-API-e38ac69e .  (note: this sample does not appear to include any examples of calling SetProperty but it should look something like: request->SetProperty(XHR_PROP_TIMEOUT, 300000); )


    -Eric.

    Tuesday, December 31, 2013 3:54 PM