The HttpContext is not supported in self hosting.
When I run my self hosted in-memory integration tests then this code does not work either:
// OWIN Self host
var owinEnvProperties = request.Properties["MS_OwinEnvironment"] as IDictionary<string, object>;
if (owinEnvProperties != null)
{
return owinEnvProperties["server.RemoteIpAddress"].ToString();
}
owinEnvProperties is always null.
So how am I supposed to get the client IP adress using self hosting?