Reputation: 59
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();
}
Upvotes: 0
Views: 290
Reputation: 57075
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
Upvotes: 1