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 0: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 thatraja 395
1 Sergey Alexandrovich Kryukov 295
2 Gihan Liyanage 261
3 kbrandwijk 204
4 CPallini 190
0 OriginalGriff 793
1 Sergey Alexandrovich Kryukov 604
2 Dnyaneshwar@Pune 604
3 Kornfeld Eliyahu Peter 530
4 thatraja 440


Advertise | Privacy | Mobile
Web04 | 2.8.140902.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