diff --git a/src/Microsoft.AspNet.Hosting/DefaultRequestIdentifierFeature.cs b/src/Microsoft.AspNet.Hosting/DefaultRequestIdentifierFeature.cs deleted file mode 100644 index 07d1f11442..0000000000 --- a/src/Microsoft.AspNet.Hosting/DefaultRequestIdentifierFeature.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNet.Http.Features; - -namespace Microsoft.AspNet.Hosting -{ - public class DefaultRequestIdentifierFeature : IRequestIdentifierFeature - { - public DefaultRequestIdentifierFeature() - { - TraceIdentifier = Guid.NewGuid(); - } - - public Guid TraceIdentifier { get; } - } -} diff --git a/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs b/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs index fd70f5840f..04b77d4113 100644 --- a/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs +++ b/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs @@ -11,6 +11,7 @@ using Microsoft.AspNet.Hosting.Server; using Microsoft.AspNet.Hosting.Startup; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Features; +using Microsoft.AspNet.Http.Features.Internal; using Microsoft.Framework.Configuration; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Internal; @@ -158,12 +159,15 @@ namespace Microsoft.AspNet.Hosting.Internal return builder.Build(); } - private Guid GetRequestIdentifier(HttpContext httpContext) + private string GetRequestIdentifier(HttpContext httpContext) { - var requestIdentifierFeature = httpContext.GetFeature(); + var requestIdentifierFeature = httpContext.GetFeature(); if (requestIdentifierFeature == null) { - requestIdentifierFeature = new DefaultRequestIdentifierFeature(); + requestIdentifierFeature = new HttpRequestIdentifierFeature() + { + TraceIdentifier = Guid.NewGuid().ToString() + }; httpContext.SetFeature(requestIdentifierFeature); } diff --git a/test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs b/test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs index 8c16801d1d..de7782c4dc 100644 --- a/test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs +++ b/test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs @@ -13,6 +13,7 @@ using Microsoft.AspNet.Hosting.Server; using Microsoft.AspNet.Hosting.Startup; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Features; +using Microsoft.AspNet.Http.Features.Internal; using Microsoft.AspNet.Testing.xunit; using Microsoft.Framework.Configuration; using Microsoft.Framework.DependencyInjection; @@ -241,7 +242,7 @@ namespace Microsoft.AspNet.Hosting // Assert Assert.NotNull(httpContext); - Assert.IsType(httpContext.GetFeature()); + Assert.IsType(httpContext.GetFeature()); } [Fact] @@ -270,7 +271,7 @@ namespace Microsoft.AspNet.Hosting // Assert Assert.NotNull(httpContext); - Assert.IsType(httpContext.GetFeature()); + Assert.IsType(httpContext.GetFeature()); } [Fact] @@ -283,8 +284,8 @@ namespace Microsoft.AspNet.Hosting httpContext = innerHttpContext; return Task.FromResult(0); }); - var requestIdentifierFeature = new Mock().Object; - _featuresSupportedByThisHost.Add(typeof(IRequestIdentifierFeature), requestIdentifierFeature); + var requestIdentifierFeature = new Mock().Object; + _featuresSupportedByThisHost.Add(typeof(IHttpRequestIdentifierFeature), requestIdentifierFeature); var hostingEngine = CreateHostingEngine(requestDelegate); // Act @@ -292,7 +293,7 @@ namespace Microsoft.AspNet.Hosting // Assert Assert.NotNull(httpContext); - Assert.Same(requestIdentifierFeature, httpContext.GetFeature()); + Assert.Same(requestIdentifierFeature, httpContext.GetFeature()); } [Fact]