Use TryAdd for ISessionStore service #2755

This commit is contained in:
Chris Ross (ASP.NET) 2018-01-26 12:16:25 -08:00
parent bedf5a55f7
commit 6d15dcf1ca
1 changed files with 2 additions and 1 deletions

View File

@ -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<ISessionStore, DistributedSessionStore>();
services.TryAddTransient<ISessionStore, DistributedSessionStore>();
services.AddDataProtection();
return services;
}