I suspect it's more likely that it's to do with what you do with the response.
The using
statement will close the StreamWriter
, and you don't even need the explicit Close
call. However, you also need a using
statement for the response:
using (var response = httpWebRequest.GetResponse())
{
...
}
If you don't have that, the connection pool for the particular host will be clogged with connections due to unclosed response.