Results 1 to 3 of 3

Thread: [RESOLVED] HTTP Web Request multi-threading time out

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2007
    Posts
    22

    Resolved [RESOLVED] HTTP Web Request multi-threading time out

    Hello,

    I have a multithreaded application that communicates with a web service by HTTP GETs.

    when the program began to experience moderate load, it began to throw "The Operation Has Timed Out" errors on the function that is submitting HTTP Web Requests and retrieving the Web Response.


    Another developer suggested this MSDN article: http://msdn.microsoft.com/en-us/library/fb6y0fyc.aspx

    He was thinking it might be related, but it looks like something you configure in a web application via its web.config .


    Also, here is the piece of my code that times out:

    Code:
       
    AwsWebRequest = System.Net.HttpWebRequest.Create("Example.com?exampleParam=example")
                AwsWebRequest.Timeout = 10000 'TODO: timeout added for testing - should be able to remove when finished - 2013-08-01
                AwsWebResponse = AwsWebRequest.GetResponse
    
    
                AwsStreamReader = New System.IO.StreamReader(AwsWebResponse.GetResponseStream)
    
                'Result parsing needs work. results will simply be to acknowledge successful request. final results will be posted back later.
                AwsResult = AwsStreamReader.ReadToEnd
                AwsWebResponse.Close()

    My question is, am I missing something? Or is this related to a default connection limit? If so, can it be changed?


    Thanks in advance!

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: HTTP Web Request multi-threading time out

    How many threads do you have active at any single moment??

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2007
    Posts
    22

    Re: HTTP Web Request multi-threading time out

    20, as there are other things going on processing 15k records in one shot, individually, in varying ways.

    It seems I may have figured it out with continued research and testing. It appears microsoft imposes a default network connection limit when contacting the same network host concurrently.

    I had to set System.Net.ServicePointManager.DefaultConnectionLimit - Found it in this MSDN link: http://msdn.microsoft.com/en-us/libr...vs.100%29.aspx


    It may default to 2 or 10 depending on the implementation of asp.net or not. I set it to something ridiculously high for testing and then ran my app at more than 2 times the pace and it experienced no time outs.


    For the information of others: I set the property on the load event for the main form: System.Net.ServicePointManager.DefaultConnectionLimit=1000
    Last edited by dontstealmyfish; Aug 7th, 2013 at 10:25 AM. Reason: added general fix line for other users

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width