【发布时间】:2011-12-08 19:49:58
【问题描述】:
我尝试使用此 dll:http://www.eggheadcafe.com/articles/20050129.asp 但无法正常工作。运行它时我总是超时。任何人都知道任何好的 dll 或 C# 示例如何检查邮件的 DNS MX 是否存在?
代码:
private static bool CheckDnsEntry(string domain)
{
string[] dnsServer = DnsMx.GetMXRecords(domain);
if (dnsServer.Length > 0)
{
return true;
}
return false;
}
string[] emailparts = email.Split('@');
if (CheckDnsEntry(emailparts[1]))...
错误:
Server Error in '/' Application.
Connection timeout
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: Connection timeout
Source Error:
Line 462: private static bool CheckDnsEntry(string domain)
Line 463: {
Line 464: string[] dnsServer = DnsMx.GetMXRecords(domain);
Line 465: if (dnsServer.Length > 0)
Line 466: {
【问题讨论】:
-
你能把你的调用代码和异常的调用堆栈贴出来吗?
-
也许您的防火墙阻止了对 DNS 的访问?