I hope you guys can help me, I'm having a problem when I try via c # make a request on my server (request is slow, takes about 10 minutes to process and returned)
For fast requests, everything works fine for slow requests (more than 10 minutes) C # does not identify a response from the http server.
The strange thing is that the same code on the server decreases if the loop works, so the problem is c#
because I identify in the database that the entire http server cycle has completed and returned
Code:
Request = (HttpWebRequest) HttpWebRequest.Create( url );
Request.Method = "get";
Request.AllowAutoRedirect = false;
Request.CookieContainer = Cookie;
Request.KeepAlive = false;
Request.ContentLength = 0;
Request.Timeout = 20 * ( 1000 * 60 ); // minutos
Request.ReadWriteTimeout = 20 * ( 1000 * 60 ); // minutos
Request.Proxy = null;
HttpWebResponse Response = (HttpWebResponse) Request.GetResponse();
Stream ResponseStream = Response.GetResponseStream();
StreamReader ResponseReader = new StreamReader( ResponseStream );
bufferResponse = ResponseReader.ReadToEnd();
Response.Close();
ResponseStream.Close();
ResponseReader.Close();
return ( bufferResponse );
I've tried using the commands:
ServicePointManager.DefaultConnectionLimit = 10;
ServicePointManager.Expect100Continue = false;
And they did not help.