4 c# model-view-controller asp.net-core
我尝试过
System.Net.Dns.GetHostEntry(HttpContext.Connection.RemoteIpAddress.ToString()).ToString();
但这没有用。我也尝试过使用
PCName = Dns.GetHostEntry(Request.ServerVariables["REMOTE_ADDR"]).HostName; 
但这对于核心似乎已被弃用
小智 7
尝试这个。
using Microsoft.AspNetCore.Http;
using System.Net;
Dns.GetHostEntry(HttpContext.Connection.RemoteIpAddress).HostName;