From 49035fd292773ef1a6d2d9c548fff3119a4b5e57 Mon Sep 17 00:00:00 2001 From: Anthony van der Hoorn Date: Mon, 28 Sep 2015 12:30:12 -0700 Subject: [PATCH] Order the setting of ContextAccessor so it happens before the BeginRequest event occurs. --- src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs b/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs index 97bdc06e23..6ecfb793ee 100644 --- a/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs +++ b/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs @@ -96,6 +96,7 @@ namespace Microsoft.AspNet.Hosting.Internal var httpContext = contextFactory.CreateHttpContext(features); httpContext.ApplicationServices = _applicationServices; var requestIdentifier = GetRequestIdentifier(httpContext); + contextAccessor.HttpContext = httpContext; if (telemetrySource.IsEnabled("Microsoft.AspNet.Hosting.BeginRequest")) { @@ -106,7 +107,6 @@ namespace Microsoft.AspNet.Hosting.Internal { using (logger.BeginScope("Request Id: {RequestId}", requestIdentifier)) { - contextAccessor.HttpContext = httpContext; await application(httpContext); } }