Skip to main content

Odata Service Broker

Kept hanging on POST + Update requests

We were having some trouble with this firing POST requests to our OData service - it would just hang (at request.GetResponse()) and the service tester would crash. No errors.


I used the following to set the RequestLength property in the request, and then it started to go through. Code snippet below...


using (MemoryStream memStream = new MemoryStream())
                        {
                            using (var memWriter = XmlWriter.Create(memStream))
                            {
                                entry.WriteTo(memWriter);
                                memWriter.Close();
                            }
                            request.ContentLength = memStream.Length;
                            using (var writer = XmlWriter.Create(request.GetRequestStream()))
                            {
                                entry.WriteTo(writer);
                                writer.Close();
                            }
                        }


Reply