Pages

Advertisement

Tuesday, November 15, 2022

[Solved] Identity Server 4 caching not working issue

 

Hey guys, I've gone through some of the issue created on IdentityServer4 which were closed without proper solution.


"Issue: Identity Server 4 Caching is not working"

In simple words, it works like charm. If you know how the DI works then you even get this issue.


Here's a simple solution:

Make sure you add the below 4 store caching API at the end of identity store configurations.

What's the cause: If the cache DI is added before any other configuration then the Cache DI would be overwritten with the new DI.

.AddInMemoryCaching()
                .AddClientStoreCache<ClientStore>()
                .AddResourceStoreCache<ResourceStore>()
                .AddConfigurationStoreCache()
                .AddCorsPolicyCache<CorsPolicyService>();


Complete solutions:

Hope this solves your issue. 

Issues::: 

https://github.com/IdentityServer/IdentityServer4/issues/2191

https://stackoverflow.com/questions/51560620/caching-does-not-appear-to-work-in-identity-server-4

https://stackoverflow.com/questions/43858231/how-to-implement-caching-on-identityserver4

https://github.com/IdentityServer/IdentityServer4/issues/5007

No comments:

Post a Comment