2016-10-31 43 views

回答

7

您可以使用HttpContext.Features.Get<IHttpConnectionFeature>() - docs

var httpConnectionFeature = httpContext.Features.Get<IHttpConnectionFeature>(); 
var localIpAddress = httpConnectionFeature?.LocalIpAddress;