仓库管理_物料管理:初始化
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using JinianNet.JNTemplate;
|
||||
using System.Net.NetworkInformation;
|
||||
using ZR.Common;
|
||||
|
||||
namespace ZR.Admin.WebApi.Extensions
|
||||
@@ -14,6 +15,29 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
Console.WriteLine(content);
|
||||
Console.ForegroundColor = ConsoleColor.Blue;
|
||||
|
||||
// 获取本地计算机的所有网络接口信息
|
||||
NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
|
||||
|
||||
foreach (NetworkInterface networkInterface in networkInterfaces)
|
||||
{
|
||||
// 过滤出活动的网络接口
|
||||
if (networkInterface.OperationalStatus == OperationalStatus.Up)
|
||||
{
|
||||
// 获取网络接口的IP属性
|
||||
IPInterfaceProperties ipProperties = networkInterface.GetIPProperties();
|
||||
UnicastIPAddressInformationCollection ipAddresses = ipProperties.UnicastAddresses;
|
||||
|
||||
foreach (UnicastIPAddressInformation ipAddress in ipAddresses)
|
||||
{
|
||||
// 输出IPv4地址
|
||||
if (ipAddress.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||
{
|
||||
Console.WriteLine("本机ip: "+ipAddress.Address.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user