Use TryAdd for ISessionStore service #2755
This commit is contained in:
parent
bedf5a55f7
commit
6d15dcf1ca
|
|
@ -4,6 +4,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Session;
|
using Microsoft.AspNetCore.Session;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
||||||
namespace Microsoft.Extensions.DependencyInjection
|
namespace Microsoft.Extensions.DependencyInjection
|
||||||
{
|
{
|
||||||
|
|
@ -24,7 +25,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||||
throw new ArgumentNullException(nameof(services));
|
throw new ArgumentNullException(nameof(services));
|
||||||
}
|
}
|
||||||
|
|
||||||
services.AddTransient<ISessionStore, DistributedSessionStore>();
|
services.TryAddTransient<ISessionStore, DistributedSessionStore>();
|
||||||
services.AddDataProtection();
|
services.AddDataProtection();
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue