Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am new to IdentityServer4.
In our project we are using IdentityServer4 in Authentication Module (Using IdentityServer4 version 4.0.4).
We are using AD and ADFS as identity provider.

Now we need to deploy the project in a load balanced environment.
As per my reading, I found that we need to use SQLServerDistributedCaching for IdentityServer in Load Balanced environment.

I have added the below reference in the startup class.
using Microsoft.Extensions.Caching.SqlServer; (Installed the required Nuget package)

Added below code in ConfigureServices method
------------------------------------------
C#
services.AddDistributedSqlServerCache(options =>
{
options.ConnectionString =[MY Sql Server Database Connection String];
options.SchemaName = "dbo";
options.TableName = "DistributedCaching";
});

=====================================================
Also, I have created the below table:
----------------------------------------------
SQL
CREATE TABLE [dbo].[DistributedCaching](
[ID] nvarchar NOT NULL,
[Value] varbinary NOT NULL,
[ExpiresAtTime] datetimeoffset NOT NULL,
[SlidingExpirationInSeconds] [bigint] NULL,
[AbsoluteExpiration] datetimeoffset NULL,
CONSTRAINT [PK_DistributedCaching] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

==============================================================
I have verified the connection string too.

Now, I log in to the application, navigating to different modules. But couldn't see any value stored in the table.
Not sure if I am missing anything.

Please help me on this. What are the value should be cached from IdentityServer and how I can store those in the table.

What I have tried:

Already mentioned in the question how I have tried.
Posted
Updated 26-Aug-20 4:47am
v3
Comments
[no name] 26-Aug-20 11:17am    
"Not sure" if you're missing anything ... or even if there is a problem. No question; just something about "concepts".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900