Added SQL Server Cache to the sample.

This commit is contained in:
Kiran Challa 2015-06-10 15:59:48 -07:00
parent 76028af354
commit 28dfa0f0c4
2 changed files with 21 additions and 7 deletions

View File

@ -4,6 +4,7 @@
using System;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.Framework.Caching.Distributed;
using Microsoft.Framework.Caching.Redis;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
@ -26,11 +27,20 @@ namespace SessionSample
// This will override any previously registered IDistributedCache service.
//services.AddTransient<IDistributedCache, RedisCache>();
// Uncomment the following line to use the Microsoft SQL Server implementation of IDistributedCache.
// Note that this would require setting up the session state database.
// This will override any previously registered IDistributedCache service.
//services.AddSqlServerCache(o =>
//{
// o.ConnectionString = "Server=.;Database=ASPNET5SessionState;Trusted_Connection=True;";
// o.TableName = "Sessions";
//});
services.AddSession();
services.ConfigureSession(o =>
{
o.IdleTimeout = TimeSpan.FromSeconds(30);
o.IdleTimeout = TimeSpan.FromSeconds(10);
});
}

View File

@ -1,16 +1,20 @@
{
"webroot": "wwwroot",
"exclude": "wwwroot/**/*.*",
"commands": {
"web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001",
"install-sqlservercache": "Microsoft.Framework.Caching.SqlServer"
},
"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-*",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
"Microsoft.AspNet.Session": "1.0.0-*",
"Microsoft.Framework.Caching.Memory": "1.0.0-*",
"Microsoft.Framework.Caching.Redis": "1.0.0-*",
"Microsoft.Framework.Caching.SqlServer": "1.0.0-*",
"Microsoft.Framework.Logging.Console": "1.0.0-*"
},
"commands": { "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" },
"frameworks" : {
"dnx451" : { }
}
"exclude": "wwwroot/**/*.*",
"frameworks": {
"dnx451": { }
},
"webroot": "wwwroot"
}