In web forms, if I need to get the IP address of a website server (say, for logging), I could get it from request.ServerVariables["LOCAL_ADDR"]
request.ServerVariables["LOCAL_ADDR"]
How can I get it in Asp.Net Core when working in Kestral for IIS or IIS Express?
You can use HttpContext.Features.Get<IHttpConnectionFeature>()- docs :
HttpContext.Features.Get<IHttpConnectionFeature>()
var httpConnectionFeature = httpContext.Features.Get<IHttpConnectionFeature>(); var localIpAddress = httpConnectionFeature?.LocalIpAddress;
Source: https://habr.com/ru/post/1659431/More articles:Pre-connect with condition - sqlGoogle SMTP Server and Sending Email with a Google Apps Service Account - EmailLaravel Artisan - reload .env variables or restart the framework - phpTesting multiple docker images with RSpec - dockerHow can you use real-time time series forecasting where each item cannot be tracked? - data-structuresComparison of a network with Kubernetes overlap - kubernetesSpark scala - how to make count () by conditioning on two lines - scalaЯрлыки приложений для Android не работают - androidDomToImage error causing a security error (Dom Exception 18) for iOS browsers only - javascriptИзменение размера UICollectionView до размера содержимого - iosAll Articles