diff --git a/src/Microsoft.AspNetCore.Http.Features/IHttpConnectionFeature.cs b/src/Microsoft.AspNetCore.Http.Features/IHttpConnectionFeature.cs
index ac30742af8..932e9bfe2c 100644
--- a/src/Microsoft.AspNetCore.Http.Features/IHttpConnectionFeature.cs
+++ b/src/Microsoft.AspNetCore.Http.Features/IHttpConnectionFeature.cs
@@ -5,11 +5,34 @@ using System.Net;
namespace Microsoft.AspNetCore.Http.Features
{
+ ///
+ /// Information regarding the TCP/IP connection carrying the request.
+ ///
public interface IHttpConnectionFeature
{
+ ///
+ /// The unique identifier for the connection the request was received on. This is primarily for diagnostic purposes.
+ ///
+ string ConnectionId { get; set; }
+
+ ///
+ /// The IPAddress of the client making the request. Note this may be for a proxy rather than the end user.
+ ///
IPAddress RemoteIpAddress { get; set; }
+
+ ///
+ /// The local IPAddress on which the request was received.
+ ///
IPAddress LocalIpAddress { get; set; }
+
+ ///
+ /// The remote port of the client making the request.
+ ///
int RemotePort { get; set; }
+
+ ///
+ /// The local port on which the request was received.
+ ///
int LocalPort { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.Http/Features/HttpConnectionFeature.cs b/src/Microsoft.AspNetCore.Http/Features/HttpConnectionFeature.cs
index 05fc485c03..ab688ec777 100644
--- a/src/Microsoft.AspNetCore.Http/Features/HttpConnectionFeature.cs
+++ b/src/Microsoft.AspNetCore.Http/Features/HttpConnectionFeature.cs
@@ -11,6 +11,8 @@ namespace Microsoft.AspNetCore.Http.Features.Internal
{
}
+ public string ConnectionId { get; set; }
+
public IPAddress LocalIpAddress { get; set; }
public int LocalPort { get; set; }
diff --git a/src/Microsoft.AspNetCore.Owin/OwinConstants.cs b/src/Microsoft.AspNetCore.Owin/OwinConstants.cs
index 028866bae2..ca14cf9cbb 100644
--- a/src/Microsoft.AspNetCore.Owin/OwinConstants.cs
+++ b/src/Microsoft.AspNetCore.Owin/OwinConstants.cs
@@ -73,6 +73,7 @@ namespace Microsoft.AspNetCore.Owin
public const string RemotePort = "server.RemotePort";
public const string LocalIpAddress = "server.LocalIpAddress";
public const string LocalPort = "server.LocalPort";
+ public const string ConnectionId = "server.ConnectionId";
public const string TraceOutput = "host.TraceOutput";
public const string Addresses = "host.Addresses";
public const string AppName = "host.AppName";
diff --git a/src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs b/src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs
index 11f3e2fab9..a69bcde215 100644
--- a/src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs
+++ b/src/Microsoft.AspNetCore.Owin/OwinEnvironment.cs
@@ -74,6 +74,9 @@ namespace Microsoft.AspNetCore.Owin
}))
},
+ { OwinConstants.CommonKeys.ConnectionId, new FeatureMap(feature => feature.ConnectionId,
+ (feature, value) => feature.ConnectionId = Convert.ToString(value, CultureInfo.InvariantCulture)) },
+
{ OwinConstants.CommonKeys.LocalPort, new FeatureMap(feature => feature.LocalPort.ToString(CultureInfo.InvariantCulture),
(feature, value) => feature.LocalPort = Convert.ToInt32(value, CultureInfo.InvariantCulture)) },
{ OwinConstants.CommonKeys.RemotePort, new FeatureMap(feature => feature.RemotePort.ToString(CultureInfo.InvariantCulture),
diff --git a/src/Microsoft.AspNetCore.Owin/OwinFeatureCollection.cs b/src/Microsoft.AspNetCore.Owin/OwinFeatureCollection.cs
index e2b7a8f83d..6809d5c4f2 100644
--- a/src/Microsoft.AspNetCore.Owin/OwinFeatureCollection.cs
+++ b/src/Microsoft.AspNetCore.Owin/OwinFeatureCollection.cs
@@ -190,6 +190,12 @@ namespace Microsoft.AspNetCore.Owin
set { Prop(OwinConstants.CommonKeys.LocalPort, value.ToString(CultureInfo.InvariantCulture)); }
}
+ string IHttpConnectionFeature.ConnectionId
+ {
+ get { return Prop(OwinConstants.CommonKeys.ConnectionId); }
+ set { Prop(OwinConstants.CommonKeys.ConnectionId, value); }
+ }
+
private bool SupportsSendFile
{
get