diff --git a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs index 48424e48cd..628390fbe3 100644 --- a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs @@ -4,6 +4,7 @@ using System; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Session; +using Microsoft.Extensions.DependencyInjection.Extensions; namespace Microsoft.Extensions.DependencyInjection { @@ -24,7 +25,7 @@ namespace Microsoft.Extensions.DependencyInjection throw new ArgumentNullException(nameof(services)); } - services.AddTransient(); + services.TryAddTransient(); services.AddDataProtection(); return services; }