【问题标题】:Error when I use XPath.XPathDocument() function使用 XPath.XPathDocument() 函数时出错
【发布时间】:2026-02-24 22:15:02
【问题描述】:

我在我的 ASP.NET/VB.NET 项目中使用此代码:

Dim sourceFile as String = "http://xml.weather.yahoo.com/forecastrss?p=94704"
Dim xPath As New XPath.XPathDocument(sourceFile)

并且第二行给出了错误: “无法连接到远程服务器”

当我在网络浏览器中浏览 url (sourceFile) 时,它会很好地打开 RSS 提要页面。 如何消除此错误?

【问题讨论】:

    标签: vb.net url xpathdocument


    【解决方案1】:

    如果您的应用程序是 unable to connect to the remote server,则与 XPath.XPathDocument 无关。

    使用其他方法检查连接,例如WebClient.

    【讨论】: