diff --git a/src/Microsoft.AspNet.Identity/IdentityServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Identity/IdentityServiceCollectionExtensions.cs index b576c140c0..5f8b467116 100644 --- a/src/Microsoft.AspNet.Identity/IdentityServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Identity/IdentityServiceCollectionExtensions.cs @@ -2,6 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Internal; using Microsoft.AspNet.Identity; using Microsoft.Extensions.DependencyInjection.Extensions; @@ -49,6 +51,8 @@ namespace Microsoft.Extensions.DependencyInjection options.SignInScheme = new IdentityCookieOptions().ExternalCookieAuthenticationScheme; }); + // Hosting doesn't add IHttpContextAccessor by default + services.TryAddSingleton(); // Identity services services.TryAddSingleton(); services.TryAddScoped, UserValidator>();