Pregunta

Below code is throwing a timeout exception after couple of calls (5 or 10 calls), it works fine always when I'm running fiddler in my machine. I read some answers here that if it's working when the fiddler is on then that means it could be a proxy issue, but how it's working some times? I've tried setting a timeout value more than the default value, still it fails.

        HttpWebRequest requiredRequest = CreateRequestWithEmptyBody(url);            
        requiredRequest.ContentType = "application/xml";

            try
            {
                requestStream = requiredRequest.GetRequestStream();
                requestStream.Write(requestBodyData, offset: 0, count: requestBodyData.Length);
                requestStream.Flush();
            }
            catch (WebException exc)
            {

            }
            finally
            {
                requestStream.Close();
            }
¿Fue útil?

Solución

Typically, this means that you forgot to call .Close() on the HTTPResponseStream that you pulled from the HttpWebRequest object.

I discuss this here: http://www.telerik.com/automated-testing-tools/blog/eric-lawrence/13-02-28/help-running-fiddler-fixes-my-app.aspx

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top