Alex Ivv

Alex Ivv

  • NA
  • 1
  • 895

request to http-server

Jul 28 2015 10:12 AM
Hi!
I have one question -
when send request to http-server:
 
HttpWebRequest req = ( HttpWebRequest )WebRequest.Create( recordingUrl );
req.Method = "GET";
req.Credentials = credentialCache;
resp = req.GetResponse();
stream = resp.GetResponseStream();
 
If after some time, we must once again make a request not related to the previous one, as actually to do?
Dispose the current?
 
stream.Close();
stream.Dispose();
resp.Close();
resp.Dispose()
 
And then all over again?

The server after a few quick successive query throws "503 Service Unavailable". It seems that he does not kill quickly old connects and falls off on exceeding the number of connections.
 
They said that it is necessary to use the old connection. But how? The new recordingUrl - new WebRequest.Create(), which obviously creates a new HttpWebRequest object, new connection.

Answers (1)