.net 无法解析远程名称

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/901340/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 12:44:47  来源:igfitidea点击:

The remote name could not be resolved

.netwindows-mobile

提问by Pankaj Pareek

i m creating mobile application for windows mobile 6.i m uploading an image on url/website. for this i m using webrequest and webresponse class.at the time of getting response i m getting this type of error-

我正在为 windows mobile 6.im 创建移动应用程序在 url/网站上上传图像。为此,我使用 webrequest 和 webresponse 类。在获得响应时,我遇到了这种类型的错误-

The remote name could not be resolved.. my code is- String url = "http://weblogs.asp.net/scottgu/rss.aspx"; System.Net.WebRequest request = System.Net.WebRequest.Create(url); request.Credentials = System.Net.CredentialCache.DefaultCredentials;

无法解析远程名称.. 我的代码是- String url = " http://weblogs.asp.net/scottgu/rss.aspx"; System.Net.WebRequest request = System.Net.WebRequest.Create(url); request.Credentials = System.Net.CredentialCache.DefaultCredentials;

        System.Net.WebResponse response = null;
        System.IO.Stream stream = null;
        response = request.GetResponse();
        stream = response.GetResponseStream();

any one can help me.. thx in Advance... Regards Pankaj Pareek

任何人都可以帮助我......提前谢谢......问候Pankaj Pareek

回答by Crippledsmurf

While I don't have specific experience with Windows Mobile this error message generally indicates a failure to resolve a hostname to an IP address. This can happen for a number of reasins including:

虽然我没有使用 Windows Mobile 的具体经验,但此错误消息通常表示无法将主机名解析为 IP 地址。发生这种情况的原因有很多,包括:

  • The client can not contact the DNS server to attempt to resolve the name. This suggests a lack of network and/or internet connectivity
  • The DNS query did not yeild a result.
  • 客户端无法联系 DNS 服务器以尝试解析名称。这表明缺乏网络和/或互联网连接
  • DNS 查询没有产生结果。

Resolution Suggestions:

解决建议:

  1. Check that the name is correctly specified
  2. Verify that there is network connectivity as this is required to communicate with the DNS server(s) used to resolve a hostname
  3. Check that the DNS server address is correct especially if they are configured staticlly.
  1. 检查名称是否正确指定
  2. 验证是否存在网络连接,因为这是与用于解析主机名的 DNS 服务器通信所必需的
  3. 检查 DNS 服务器地址是否正确,特别是如果它们是静态配置的。

Hope this helps

希望这可以帮助

回答by JaredPar

This means that while processing the URL for the web server, the underlying network connection was unable to convert the name into an IP address. The two most likely reasons this could be happening are

这意味着在处理 Web 服务器的 URL 时,底层网络连接无法将名称转换为 IP 地址。发生这种情况的两个最可能的原因是

  1. You introduced a typo into the URL you put into the application
  2. You are currently experiencing a DNS issue on your network
  1. 您在输入应用程序的 URL 中引入了拼写错误
  2. 您目前在网络上遇到 DNS 问题

The quickest way to verify this is to try and pull up the web site in the mobile browser. If you can't pull it up it's likely a DNS issue.

验证这一点的最快方法是尝试在移动浏览器中打开网站。如果您无法将其拉起,则可能是 DNS 问题。

回答by Shane Powell

My number one suggestion to you is to try it in the browser on the device. If it works on the browser then it should work in your code. If it doesn't then it's a setup issue on your device OR if you are connected by ActiveSync, it may be a network issue on your host machine (like a firewall).

我给您的第一个建议是在设备上的浏览器中尝试。如果它适用于浏览器,那么它应该适用于您的代码。如果不是,则是您设备上的设置问题,或者如果您通过 ActiveSync 连接,则可能是主机上的网络问题(如防火墙)。

Also note that your code will NOT automatically create a cellular network connection. You are to the Connection Managerto requestit before doing your web requests.

另请注意,您的代码不会自动创建蜂窝网络连接。在执行 Web 请求之前,您需要通过连接管理器请求它。