.net core获取服务器本地IP及Request访问端口

 string str = (Request.HttpContext.Connection.LocalIpAddress.MapToIPv4().ToString() + ":" + Request.HttpContext.Connection.LocalPort;

最终可以得到本地IP及访问端口.

猜你喜欢

转载自www.cnblogs.com/ontheroute/p/9207749.html