M
Mark
I create a HttpWebRequest as follows:
m_req = (HttpWebRequest) WebRequest.Create(url);
m_req.Timeout = 10000*1000;
m_req.Method = "POST";
// issue request
I issue my request and receive the HTTP headers. However as the
request is a long running dynamic request for computed data the body
will not be sent for some time. What happens to me is that the request
times out on the Read long before my 10000 secs is up (typically
500-1000 secs)!
I can see no other timeout to set to prevent this happening - is there
any other
workaround?
HttpWebResponse res = (HttpWebResponse) m_req.GetResponse();
// I can see res.Headers
// Read on res.GetResponseStream() times out
The reason that the server sends the HTTP headers before the body is
because the requests are dynamic it can NOT predict the size of the
response document and therefore just produces it as it process the
request (e.g. a large database query of indeterminate response size).
My basic question is the HTTP timeout being propagated to the lowlevel
Read method calls!?
I have used the following code to read the message in a chunked
fashion and this still times out prematurely with the stack trace:
System.Net.WebException: The operation has timed-out.
at System.Net.ConnectStream.Read(Byte[] buffer, Int32 offset, Int32
size)
at System.IO.StreamReader.ReadBuffer(Char[] userBuffer, Int32
userOffset, Int32 desiredChars, Boolean& readToUserBuffer)
at System.IO.StreamReader.Read(Char[] buffer, Int32 index, Int32
count)
at ...
Many thanks in advance for any useful answers!
m_req = (HttpWebRequest) WebRequest.Create(url);
m_req.Timeout = 10000*1000;
m_req.Method = "POST";
// issue request
I issue my request and receive the HTTP headers. However as the
request is a long running dynamic request for computed data the body
will not be sent for some time. What happens to me is that the request
times out on the Read long before my 10000 secs is up (typically
500-1000 secs)!
I can see no other timeout to set to prevent this happening - is there
any other
workaround?
HttpWebResponse res = (HttpWebResponse) m_req.GetResponse();
// I can see res.Headers
// Read on res.GetResponseStream() times out
The reason that the server sends the HTTP headers before the body is
because the requests are dynamic it can NOT predict the size of the
response document and therefore just produces it as it process the
request (e.g. a large database query of indeterminate response size).
My basic question is the HTTP timeout being propagated to the lowlevel
Read method calls!?
I have used the following code to read the message in a chunked
fashion and this still times out prematurely with the stack trace:
System.Net.WebException: The operation has timed-out.
at System.Net.ConnectStream.Read(Byte[] buffer, Int32 offset, Int32
size)
at System.IO.StreamReader.ReadBuffer(Char[] userBuffer, Int32
userOffset, Int32 desiredChars, Boolean& readToUserBuffer)
at System.IO.StreamReader.Read(Char[] buffer, Int32 index, Int32
count)
at ...
Many thanks in advance for any useful answers!