C#dns没有提出这样的主机是众所周知的 [英] C# dns raise no such host is known

查看:93
本文介绍了C#dns没有提出这样的主机是众所周知的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello ,

i have to try to connect one ip address in my desktop application with the 

dns.beginhostentry but it gives error "no such host is known" 

while i am using with alias its works fine for the same ip 

address. 

example :

string ip_address ="123.456.789.012" 
string alias = "mymachine" 'this is alias of above ip address.

DNS.BeginGetHostEntry(ip_address,abcd,this); this statement does 

not works. it show the error that "no such host is known".

while

DNS.BeginGetHostEntry(alias,abcd,this);

this statement does works no issues at all.



please solve this query.

thanks





我尝试了什么:





What I have tried:

Note : i dont want to do host entry into the host file of the any 

particular pc. because i want to fix the ip address at all. 

推荐答案

如果您阅读 BeginGetHostEntry 的文档,则IP地址参数为a System.Net.IPAddress ,与字符串表示形式不同。将您的号码转换为 IPAddress ,然后重试。
If you read the documentation for BeginGetHostEntry, the IP address parameter is a System.Net.IPAddress, which is not the same as a string representation. Convert your numbers to an IPAddress and try again.


这篇关于C#dns没有提出这样的主机是众所周知的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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