The remote name could not be resolved

泄露秘密 提交于 2019-12-12 13:22:16

问题


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-

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;

        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


回答1:


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:

  • 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.

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.

Hope this helps




回答2:


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

  1. You introduced a typo into the URL you put into the application
  2. You are currently experiencing a DNS issue on your network

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.




回答3:


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).

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



来源:https://stackoverflow.com/questions/901340/the-remote-name-could-not-be-resolved

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!