Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

Thanks,
Yashu .
Posted
Comments
Sergey Alexandrovich Kryukov 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?
--SA
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


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900