I'm using it in Quartz.Net framework. Every Job(thread) has only one web request
Here is the check list:
All disposable objects are used in using block!
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) using (Stream stream = response.GetResponseStream()) using (StreamReader reader = new StreamReader(stream)) str = reader.ReadToEnd();
- ServicePointManager.Expect100Continue = false;
- ServicePointManager.DefaultConnectionLimit = 1000;
- ServicePointManager.MaxServicePoints = 1000;
- request.KeepAlive=false
- request.Timeout = 5000;
- request.ReadWriteTimeout = 5000;
- request.ServicePoint.ConnectionLeaseTimeout = 5000;
- request.ServicePoint.MaxIdleTime = 5000;
I'm using Stopwatch to measure web request time. These are that logs:
Abnormal Web Request time: 16333 ms
Abnormal Web Request time: 8350 ms
Abnormal Web Request time: 9846 ms
Abnormal Web Request time: 7545 ms
Abnormal Web Request time: 6662 ms
Abnormal Web Request time: 18332 ms
Any Idea?
PS: This question is summarized version of Timeout supported Multithreaded Web Request