ASP NET Core MVC-如何配置进程外会话状态? [英] ASP NET Core MVC - How to configure Out of Process Session State?

查看:116
本文介绍了ASP NET Core MVC-如何配置进程外会话状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用ASP.NET Core MVC配置进程外会话状态(使用Windows状态服务器或SQL Server)?

Is there a way to configure out of process session state (using the the Windows State server or SQL Server) with ASP.NET Core MVC?

推荐答案

感谢Marcin.我想通了...但是在将net46而不是核心作为目标时,使其很难工作(net46不支持Microsoft.Extensions.Caching.SqlConfig.Tools的所有版本,并且因为我的应用程序不支持,所以尚不明显) t引发错误-只是获取我正在设置的会话变量的空值...)

Thanks Marcin. I figured it out... but it was tricky getting it to work when targeting net46 instead of core (not all versions of Microsoft.Extensions.Caching.SqlConfig.Tools are supported by net46 and it wasn't apparent because my app wasn't throwing errors - just getting null values for the session variables I was setting...)

最终对我有用的是project.json中的此配置:

What finally worked for me was this configuration in project.json :

在依赖项下:

"Microsoft.AspNetCore.Session": "1.0.0",
"Microsoft.Extensions.Caching.SqlServer": "1.1.0-preview1-final",
"Microsoft.Extensions.Caching.SqlConfig": "1.0.0-rc1-final"

在工具下:

"Microsoft.Extensions.Caching.SqlConfig.Tools": "1.0.0-rc1-final"

这篇关于ASP NET Core MVC-如何配置进程外会话状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆