Click here to Skip to main content
12,948,124 members (72,652 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,

I am connecting to our applications's server, using HttpWebRequest.
but the HttpWebRequest.GetResponse() is taking long time when i am running load test.

GetRequestStream takes ~1000 ms seconds for first 2 or 3 requests, and the getResponse() time taken is upto ~350 ms each time, whihc is too much for our application.

My Code is :

WebRequest.DefaultWebProxy = null; // I have put this line after reading in google but still no luck
System.Net.HttpWebRequest httpURLConnection = null;

httpURLConnection = (HttpWebRequest)WebRequest.Create(argURI);
httpURLConnection.CachePolicy = noCachePolicy;
httpURLConnection.Timeout = m_connectionTimeOut;
httpURLConnection.ReadWriteTimeout = m_readTimeOut;
httpURLConnection.AllowAutoRedirect = true;
httpURLConnection.Proxy = null;
httpURLConnection.UserAgent = "XXXXX";
httpURLConnection.Headers.Add(HttpUtils.ACCEPTED_ENCRYPTION, protocolName);
System.IO.Stream outputStream = httpURLConnection.GetRequestStream(); //This line takes ~1000 ms for first 1 or requests,
HttpWebResponse response = (HttpWebResponse)conn.GetResponse(); // This line always takes ~500 ms

Please help me in improving the perormance,
I am using Windows XP and .Net 3.5

Yashu .
Posted 25-Jan-12 0:19am
SAKryukov 25-Jan-12 14:39pm
I don't see a problem. Maybe, the server part is so slow, not your client. How about using some other client, such as available Web browser. If this is as slow as with your client, what's the problem?
Reuben Sant 31-May-12 7:51am
i have the same issue. the server is not slow. it is responding in less than a second in a browser. using HttpWebRequest it takes 8-10 seconds.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,344
CHill60 3,275
Maciej Los 2,703
Jochen Arndt 1,935
ppolymorphe 1,795

Advertise | Privacy | Mobile
Web02 | 2.8.170524.1 | Last Updated 25 Jan 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100