为什么XmlDocument.LoadXml抛出System.Net.WebException? [英] Why does XmlDocument.LoadXml throw System.Net.WebException?
本文介绍了为什么XmlDocument.LoadXml抛出System.Net.WebException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么 System.Xml.XmlDocument.LoadXml
方法throw System.Net.WebException
?
Why does System.Xml.XmlDocument.LoadXml
method throw System.Net.WebException
?
如果 MSDN 是对的, LoadXml
应该最多给我一个 System.Xml.XmlException
。
This is really mind boggling crazy, if MSDN was right, LoadXml
should at most give me a System.Xml.XmlException
.
然而我有奇怪的例外,如:
Yet I have weird exceptions like:
底层连接关闭:连接意外关闭。
The underlying connection was closed: The connection was closed unexpectedly.
Dim document As New XmlDocument
document.LoadXml("<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd""><x></x>")
MsgBox(document.LastChild.Name)
是什么导致异常?
推荐答案
Edwin给了你解决方案,连锁行业告诉你连接丢失的原因:
Edwin gave you the solution, and I'm giving you the reason for the connection drop:
http://www.w3.org/blog/systeam/2008/02/08/w3c_s_excessive_dtd_traffic/
这篇关于为什么XmlDocument.LoadXml抛出System.Net.WebException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文