Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.5
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 25-Jan-12 1:19am
Comments
SAKryukov at 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 at 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
0 Sergey Alexandrovich Kryukov 370
1 DamithSL 235
2 OriginalGriff 215
3 Zoltán Zörgő 124
4 Dave Kreskowiak 120
0 OriginalGriff 7,610
1 DamithSL 5,559
2 Sergey Alexandrovich Kryukov 5,324
3 Maciej Los 4,961
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 25 Jan 2012
Copyright © CodeProject, 1999-2014
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