HttpWebrequest 60 Seconds Timeout RRS feed

  • General discussion

  • I try to use the httpwebrequest with Windows Phone.
    Everything works fine, but sometimes the webrequest needs around 100 seconds to get an answer.
    Always after 60 Seconds i got a Timeout Exception.
    Is it possible to increase the timeout in the httpWebrequest or is any workaround for this?

    Thanks for Help!

    Tuesday, May 29, 2012 2:57 PM

All replies

  • Hi,
    It doesn't appear to be possible to extend the timeout.  You might need to incorporate some sort of retry mechanism.

    Tuesday, May 29, 2012 9:50 PM
  • One thing you can do is to enable GZIP compression on the http request.  Usually they complete quite a bit faster, and you are using less bandwidth too. :)

    Jeff Wilcox blog on GZIP

    I used this in my Mariners News baseball app and found a drop from the average user of more than 50% time reduction.  In my case the averages were up around 56 secs, and some users were timing out.  Once I added the gzip the average users time is under 28 seconds and I rarely see a timeout.

    Tuesday, May 29, 2012 10:06 PM
  • Thanks for the Answer.

    Problem is, if i retry this, i got a new Ticket Number.
    So this is not a solution for me.
    Too bad that is not possible to extend the Timeout.
    I try also the GZIP compression without success.

    Maybe with the new Windows Phone 8 Framework it is possible to extend the Timeout.
    Thursday, May 31, 2012 7:48 AM
  • ~100 seconds is a long time to wait... I get complaints from users at ~15 seconds.

    But - something to try:
    If you have access to the server side, You could send back data immediately
    wait for a second,
    send more data, etc.

     - if you do that, you probably will be able to get around the phones connection limit.

    I have an HttpWebRequest that can stay connected to shoutcast streams for hours, so I suspect the timeout internaly is just the "time to first data in response."

    If you don't have access to the ticket server, spin up a proxy server that receives the call and starts the ticket process.  You can then either make another call to the proxy to get status repeatedly, or do the buffered response like I mentioned above.
    Friday, June 1, 2012 9:26 PM