473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Webrequest threading timeout

LS
Hi Guys,

I'm building a spider application for our intranet and have problems making
webrequests.
I spin of 10 threads, they all do the same code, a webrequest and processing
of the page.
This is the code of the webrequest:
--------------------------------------------------------
req = HttpWebRequest.Create(myRSS.RSSLink)
req.UserAgent = "Mozilla/6.0 (MSIE 6.1; Windows NT 5.1;)"
req.MaximumAutomaticRedirections = 20
req.Timeout = 10000
req.KeepAlive = False
res = req.GetResponse
--------------------------------------------------------
The code always times out on the last line.
If I fetch the page manually with my browser it works fine.

any ideas?
Nov 21 '05 #1
2 2414
Is the URL an https site? If so, you're running into the 2 max
simultaneous connection limit.

Bruce Dunwiddie
http://www.csvreader.com

LS wrote:
Hi Guys,

I'm building a spider application for our intranet and have problems making
webrequests.
I spin of 10 threads, they all do the same code, a webrequest and processing
of the page.
This is the code of the webrequest:
--------------------------------------------------------
req = HttpWebRequest.Create(myRSS.RSSLink)
req.UserAgent = "Mozilla/6.0 (MSIE 6.1; Windows NT 5.1;)"
req.MaximumAutomaticRedirections = 20
req.Timeout = 10000
req.KeepAlive = False
res = req.GetResponse
--------------------------------------------------------
The code always times out on the last line.
If I fetch the page manually with my browser it works fine.

any ideas?


Nov 21 '05 #2
Neo
Hi,

you have two problem.

1. 2 Connection Limit
You can solve this limit by setting

req.ServicePoint.ConnectionLimit = 30;

then you have a max of 30 connections instead of 2

2. HttpWebRequest Bug ;-)
Here is the KB Article....

http://www.kbalertz.com/kb_904262.aspx

.....read it and try to set the timeouts like the article says....
I had the same Problem and the article has no effect on my 2003 Server.

To solve the Problem i had to write a wrapper for the wininet.dll. You can
find examples at www.codeproject.com.
"shriop" wrote:
Is the URL an https site? If so, you're running into the 2 max
simultaneous connection limit.

Bruce Dunwiddie
http://www.csvreader.com

LS wrote:
Hi Guys,

I'm building a spider application for our intranet and have problems making
webrequests.
I spin of 10 threads, they all do the same code, a webrequest and processing
of the page.
This is the code of the webrequest:
--------------------------------------------------------
req = HttpWebRequest.Create(myRSS.RSSLink)
req.UserAgent = "Mozilla/6.0 (MSIE 6.1; Windows NT 5.1;)"
req.MaximumAutomaticRedirections = 20
req.Timeout = 10000
req.KeepAlive = False
res = req.GetResponse
--------------------------------------------------------
The code always times out on the last line.
If I fetch the page manually with my browser it works fine.

any ideas?


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: news.microsoft.com | last post by:
Hello I try to implement "retry" if connection to web ends with "time out". I want to give a chance to prolong waiting for response. The following code is taken from WebRequest.GetResponse()...
4
by: Terry | last post by:
Hello, I am trying to get a response for an .aspx page in my current project (same virtual directory) by using WebRequest.GetResponse but I keep getting a exception with "500 Internal server...
0
by: Gordon | last post by:
I use the following code to get source HTML. The second line seems to work when I get no response from a site. However, I want to stop the request if it's taking more than 20 - 30 seconds. I can't...
2
by: KSC | last post by:
Hello, I have used a thread timer as in the documentation on MSDN in my VB.NET application. Using System.Threading.Interlocked.Increment I increment the counter to a certain point, perform an...
1
by: Christian Urbanczyk | last post by:
Hello! I have a problem with the Webrequest. I've search everywhere to find an answer but it seems that no one has the the problem before. So i hope somebody can help me here! Following Code:...
4
by: JimD | last post by:
Is this safe? Any pitfalls? I have done threading in regular C# apps, but haven't had a needs to do threading in ASP.Net, until now. The issue I have ran into is this: Our corporate portal...
0
by: thomasabcd | last post by:
Hi, During the user's registration I wan't to geo-code an address using localsearchmaps.com/geo. For that purpose I use a webrequest like this: string url =...
3
by: Jonathan | last post by:
I appreciate anyone's insight on this as I am new to web programming with .NET. I have a simple method which I use to send various HTTP requests to a web server (snippet below). On the first...
2
by: kkb | last post by:
Hello! First, I'm sorry because of my english... I'll try to be understandable! I've got a strange problem using .NET 2003 C# and I haven't figured it out for a long time. I'm implementing an...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.