var test1 = HttpContext.Features.Get<IHttpConnectionFeature>();
var test2 = HttpContext.Connection.RemoteIpAddress;
When running the application locally on IISExpress, these two lines correctly return the value 0:0:1
.
When I publish the application on IIS 7.5 (which is running on a VM). RemoteIpAddress
is always null
I am using ASP.Net 5 RC 1.
How can I get the client's IP address in an ASP.NET 5 application ?
I tried the solutions in the following questions, however I have the problem mentioned above:
See Question&Answers more detail:os