I am getting IP address by following code:
var remoteIpAddress = HttpContext?.Connection?.RemoteIpAddress?.ToString ();
This is working okay when I am running on IIS with accessing by IP address (public IP address of my ISP network).
I host on another server but mapping to domain name (cannot be accessed by IP due to multiple website hosting on IIS).
It is working fine just not getting the remote IP address of client acceessing.
Also, I try the following code recommended by Microsoft but it is not working.
services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders =
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
});