We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(8)
更新 2018/5/23:
查看 MichaC 的回答,了解具有 .NET 的较新库标准支持。
原始答案:
Alexander 的 ARSoft.Tools.Net 库雷纳特似乎把这项工作做得很好。
它可以从 NuGet 获得:
导入命名空间:
然后进行同步查找就像这样简单:
这为我们提供了输出:
在幕后,它看起来像库构造了发送到解析器所需的 UDP(或 TCP)数据包,例如你可能会期望。该库甚至具有发现要查询哪个 DNS 服务器的逻辑(通过 DnsClient.Default 调用)。
完整文档可以在此处找到。
Update 2018/5/23:
Check out MichaC's answer for a newer library that has .NET standard support.
Original Answer:
The ARSoft.Tools.Net library by Alexander Reinert seems to do the job pretty well.
It's available from NuGet:
Import the namespace:
Then making a synchronous lookup is as simple as:
Which gives us the output:
Underneath the hood, it looks like the library constructs the UDP (or TCP) packets necessary to send to the resolver, like you might expect. The library even has logic (invoked with
DnsClient.Default
) to discover which DNS server to query.Full documentation can be found here.
只是扮演我自己的库,因为没有任何 .net core / xplat 支持... https://github。 com/MichaCo/DnsClient.NET
它工作得非常好,如果你愿意的话,它可以为你提供
挖掘
之类的日志消息。使用简单
,可与在任何端口、多个服务器等上运行的自定义服务器配合使用...
另请参阅 DnsClient 网站更多细节
Just roled my own library because there was nothing for .net core / xplat support... https://github.com/MichaCo/DnsClient.NET
It works pretty great and gives you
dig
like log messages if you want.Simple to use
and works with custom servers running on any ports, multiple servers, etc...
see also DnsClient Website for more details
我花了一整天的时间弄清楚如何发送/接收 dns 请求并想出了这个。它是一个完整的通用处理程序。您只需设置 dns 服务器并传入 'd' 例如。 my.website.com?d=itmanx.com
I spent all day figuring out how to send/receive dns requests and came up with this. Its a complete generic handler. You just have to set the dns server and pass in 'd' eg. my.website.com?d=itmanx.com
我的方法是使用 nslookup.exe 来检索 MX 记录。
解决方案并不像重写整个 DNS 或使用系统 DLL 那样奇特 ->但它可以工作,只需少量的线条。
为了让事情正确,这段代码>正常工作<它资源效率不高,速度也不快,并且有很大的改进空间(多个主机名,异步,更有用的返回值,添加优先级):
应该国际化,因为 nslookup 不支持任何翻译(我正在一台德国机器上工作,我得到了英语输出)。
结果是这样的字符串:
My approach was to use
nslookup.exe
to retreive the MX record.The solution is not as fancy as rewriting whole DNS or using a System DLL -> but it works, with a little amount of lines.
To get things right, this code >just works< it's not ressource efficient nor fast and has a lots of room for improvment (multiple hostnames, async, more usefull return value,adding the priority):
Should be working international, since
nslookup
does not support any translation (I'm working on a German machine and I'm getting english output).The result are strings like this:
接受的答案不适用于 .NET Framework < 4.5,所以建议那些不能使用 ARSOFT.Tools 的人可以使用 https://dndns.codeplex 中的 DNDN .com
下面给出的是一个控制台应用程序,它返回给定域的 MX 记录并修改其示例。
The accepted answer doesn't work for .NET framework < 4.5, so would suggest that those of you who can't use ARSOFT.Tools can use DNDNs from https://dndns.codeplex.com
Given below is a console application that returns the MX record for a given domain modifying their examples.
这是我仅用来查找 MX 记录的类。
以下是如何使用它。
Here is a Class I use to look up MX records only.
Here is how you use it.
我写了一个简单的 URL,表示
不要滥用,
如果电子邮件存在或可能存在,则返回 1,如果不存在,则返回 0
非常适合检查:
对于像 yahoo 这样的其他人总是返回 1
I wrote a simply URL for that means
Do not abuse
Return 1 if email exists or may exist, 0 if not
Works great in order to check:
For others like yahoo always returns 1
您可以使用此开源库来几乎可以执行您通常需要的任何类型的查询。
用法:
You can use this open source library to do almost any kind of query you would usually need.
Usage: