HttpWebRequest.GetRequestStream() appeared to hang

After about two successful uploads to the Silverlight Streaming Servers, req.GetRequestStream() appeared to hang. Actually it was waiting for a free connection for 15 minutes (since that is what I had now set the timeout to) and couldn’t get one.

I already made sure I was closing the streams I was explicitly using, i.e.

using (Stream requestStream = req.GetRequestStream()) {...}

But I found I also needed to close the response even though I hadn’t referred to it (unfortunately HttpWebRequest isn’t disposable and doesn’t have an overall close method):

I should really be checking the response though...

One thought on “HttpWebRequest.GetRequestStream() appeared to hang

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s