简体   繁体   English

.NET Core 2中的状态服务器会话状态

[英]State Server Session State in .NET Core 2

I am trying to add sessionState mode="StateServer" to ASP.NET Core 2, but cannot find examples. 我正在尝试将sessionState mode="StateServer"添加到ASP.NET Core 2,但是找不到示例。

Trying to follow steps from this tutorial , but I'm unable to edit the auto-generated web.config to add sessionState node and not clear how to configure services in startup.cs . 尝试按照本教程中的步骤进行操作,但是我无法编辑自动生成的web.config以添加sessionState节点,并且无法清除如何在startup.cs配置服务。

Samples I found are for a distributed cache for SQLServer and REDIS . 我发现的示例适用于SQLServer和REDIS分布式缓存

  1. Is it possible to use StateServer mode for Session State in .NET Core 2? 是否可以在.NET Core 2中将StateServer模式用于会话状态?
  2. If Yes, would you, please, point to some example of how to configure appsettings.json to add variables similar to sessionState mode="StateServer" ? 如果是,请指向一些示例,该示例如何配置appsettings.json以添加类似于sessionState mode="StateServer"变量?

No, session depends on IDistributedCache for storage. 不,会话取决于IDistributedCache的存储。 In other word, The session data is backed by a cache. 换句话说,会话数据由缓存支持。 We have providers for Redis and SQL, or you can provide your own implementation. 我们有Redis和SQL的提供程序,或者您可以提供自己的实现。 There is nothing like configuring SessionState mode in .net core as it was in earlier Asp.net. 没有像在早期的Asp.net中那样在.net core中配置SessionState模式。

Implementation of IDistributedCache will determine the configurations for session. IDistributedCache的实现将确定会话的配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM