Install NuGet package
dotnet add package Caching.SqlServer.Infastructure --version 1.0.1
Register services after registering Sql Server Distributed caching
public void ConfigureServices(IServiceCollection services)
{
...
services.AddDistributedSqlServerCache(options =>
{
options.ConnectionString = Configuration.GetConnectionString("CacheDbConnection");
options.SchemaName = "app";
options.TableName = "Cache";
}).AddSqlServerCachingInfrastructure();
...
}
Initiate setup from the pipeline
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
...
app.SetupSqlServerCachingInfrastructure();
...
}