Redis Cache in a .NET framework 4.6.2 application

430 Views Asked by At

I am trying to implement Redis Cache in a .NET framework 4.6.2 application.

Have installed Microsoft.Extensions.Caching.StackExchangeRedis and StackExchange.Redis nuget packages and wanted to add Redis as caching provider in the app, by adding it in the services of Global.asax.cs

services.Add(typeof(IDistributedCache),new RedisCache(new RedisCacheOptions(){Configuration = "cluster-name", InstanceName = "instance-name"} ));

however I'm getting an exception

System.ArgumentException: 'The service type RedisCache is not supported.
Parameter name: serviceType'

Please let me know if you have any suggestion how to sort it out. Any help will be much appreciated. Thank you.

0

There are 0 best solutions below