XDocument Load函数抛出错误“无法解析URL"; [英] XDocument Load function throw error "Could not Resolve URL"

查看:72
本文介绍了XDocument Load函数抛出错误“无法解析URL";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用XDocument Load函数读取xml文件.我创建了一个测试项目,并使用此方法,工作正常.当我在项目中使用此功能时,引发异常无法解析url"

我的代码是

Hi All,

I am using XDocument Load function to read the xml file. I created a test project and use this method, work fine. When I use this function in my project, throw exception "Could not resolve url"

My Code is

XDocument doc = XDocument.Load("http://meet68571338.adobeconnect.com/api/xml?action=common-info");



异常详细信息:

System.Net.WebException被捕获
Message =无法解析远程名称:"meet68571338.adobeconnect.com"
来源=系统
StackTrace:
在System.Net.HttpWebRequest.GetResponse()
在System.Xml.XmlDownloadManager.GetNonFileStream处(Uri uri,ICredentials凭据,IWebProxy代理,RequestCachePolicy cachePolicy)
在System.Xml.XmlDownloadManager.GetStream(Uri uri,ICredentials凭据,IWebProxy代理,RequestCachePolicy cachePolicy)
在System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri,字符串角色,ObjectToReturn的类型)
在System.Xml.XmlReaderSettings.CreateReader(String inputUri,XmlParserContext inputContext)
在System.Xml.XmlReader.Create(String inputUri,XmlReaderSettings设置,XmlParserContext inputContext)
在System.Xml.Linq.XDocument.Load中(字符串uri,LoadOptions选项)
在System.Xml.Linq.XDocument.Load(String uri)

InnerException:


请指导我解决问题.



Exception Details:

System.Net.WebException was caught
Message=The remote name could not be resolved: ''meet68571338.adobeconnect.com''
Source=System
StackTrace:
at System.Net.HttpWebRequest.GetResponse()
at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
at System.Xml.Linq.XDocument.Load(String uri)

InnerException:


Please guide me to resolve the problem.

推荐答案

可能有2个原因;

1.您没有连接到互联网.
2.您的VS需要代理才能连接到Internet.
There could be 2 reasons;

1. You are not connected to internet.
2. Your VS need proxy to connect to the internet.


这篇关于XDocument Load函数抛出错误“无法解析URL";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆