获取本机IP12345678910111213public static string GetLocalIp(){ ///获取本地的IP地址 string AddressIP = string.Empty; foreach (IPAddress _IPAddress in Dns.GetHostEntry(Dns.GetHostName()).AddressList) { if (_IPAddress.AddressFamily.ToString() == "InterNetwork") { AddressIP = _IPAddress.ToString(); } } return AddressIP;} 相关链接(侵删) c#获取本机IP =================我是分割线================= 欢迎到公众号来唠嗑: