In 4.0 when you call HttpWebRequest.GetResponse()
, it will "close" the request stream if it's not been done before, thus the request continues. On 3.5, it will remain opened and wait for it to be closed before the request is sent.
The easiest "fix" (or workaround) is to explicitly close the request stream after writing to it:
var requestBody = XDocument.Parse(content);
using (var writer = XmlWriter.Create(request.GetRequestStream()))
{
requestBody.Save(writer);
}
request.GetRequestStream().Close();