把Dns.Resolve()改为Dns.GetHostEntry()便可code
IPHostEntry hostEntry = Dns.GetHostEntry(strDomain); IPEndPoint ipEndPoint = new IPEndPoint(hostEntry.AddressList[0], 0); string ipAddress = ipEndPoint.Address.ToString(); MessageBox.Show("IP地址:"+ipAddress);