I have the following code to load XML
var ms = new GetXmlMemoryStreamFromSomewhere();
ms.Flush();
ms.Position = 0;
// Build the XmlDocument from the MemorySteam of (usually UTF-8) encoded bytes
xmlDocument.Load(ms);
My stream is 27011 in byte size. The last line in the above code fails with System.Net.WebException Operation timed out
The Watch
for ms.Position
shows 4096
which means it did not read beyond 4096 bytes.
Any pointers on this would be appreciated.
My XML had a DOCTYPE delcaration at the top, and
XmlDocument
's Load method was trying to download the DTD of the DOCTYPE which took too long and timed out.I set the
XmlResolver
property to null and now my code works fine.