Hi,
I have a multi-thread application (in c#) that it does multiples HTTP GET
to uri. Suddenly after of thousand of requests, i get timeout webException but destination server is OK if i test using browser. The code is:
public static string Get(string uri)
{
string responseData = string.Empty;
using (WebClient wc = new WebClient())
{
responseData = wc.DownloadString(uri);
}
return responseData;
}
I think it is dispose connection issue or similar error. Any body has same problem?
Thx in advance,
PS I have used HttpWebResponse
too. But i get same error.
PS OS is Windows 2003 server. So i think is not connection limits.
I have try with this code too and i get same error
public static string Get2(string uri)
{
string responseData = string.Empty;
WebRequest request = WebRequest.Create(uri) as HttpWebRequest;
request.Method = "GET";
request.Timeout = 35000;
using(HttpWebResponse response = (HttpWebResponse)request.GetResponse() as HttpWebResponse)
{
using(Stream dataStream = response.GetResponseStream ())
{
using(StreamReader reader = new StreamReader (dataStream))
{
responseData = reader.ReadToEnd();
}
}
}
return responseData;
}