SQLServer 存在哪些会话提供程序类型?
What session provider types exist for SQLServer?
如果您想在 web.config 中实施 SQL 会话,您通常需要一些简单的东西,例如:
<sessionState mode="SQLServer" sqlConnectionString="myConnectionString"/>
但是,如果您想拥有一个自定义提供程序,以便使用配置生成器来隐藏连接字符串,您可以编写以下内容:
<sessionState mode="Custom" customProvider="SQLSessionProvider">
<providers>
<add name="SQLSessionProvider" connectionStringName="SQLSessionService" type=""/>
</providers>
</sessionState>
<connectionStrings configBuilders="CS_Environment">
<add name="SQLSessionService" connectionString="Environment_Key_Here" />
</connectionStrings>
问题是我不知道 mode=SQLServer
存在什么类型。在我的搜索中,我看到了 OBDC 会话的示例,其中 type=ObdcSessionStateStore
以及其他各种会话提供程序,但 none 用于 SQLServer.
SQL服务器存在哪些会话提供程序类型?
您可以为此使用并通过 Nuget 包管理器安装的 type
是
Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync
也应该安装 SessionState.SessionStateModule。如果您是第一次将它安装到您的项目中,它会在您的 web.config
中为您创建一个 <sessionState>
模板。下面是如何使用它的示例:
<connectionStrings configBuilders="CS_Environment">
<add name="SQLSession_Connection" providerName="System.Data.SqlClient" connectionString="SQLSessionProvider-configBuilder_failed" />
</connectionStrings>
<sessionState cookieless="false" regenerateExpiredSessionId="true" mode="Custom" customProvider="SqlSessionStateProviderAsync">
<providers>
<add name="SqlSessionStateProviderAsync" connectionStringName="SQLSession_Connection" type="Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync, Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</providers>
</sessionState>
如果您想在 web.config 中实施 SQL 会话,您通常需要一些简单的东西,例如:
<sessionState mode="SQLServer" sqlConnectionString="myConnectionString"/>
但是,如果您想拥有一个自定义提供程序,以便使用配置生成器来隐藏连接字符串,您可以编写以下内容:
<sessionState mode="Custom" customProvider="SQLSessionProvider">
<providers>
<add name="SQLSessionProvider" connectionStringName="SQLSessionService" type=""/>
</providers>
</sessionState>
<connectionStrings configBuilders="CS_Environment">
<add name="SQLSessionService" connectionString="Environment_Key_Here" />
</connectionStrings>
问题是我不知道 mode=SQLServer
存在什么类型。在我的搜索中,我看到了 OBDC 会话的示例,其中 type=ObdcSessionStateStore
以及其他各种会话提供程序,但 none 用于 SQLServer.
SQL服务器存在哪些会话提供程序类型?
您可以为此使用并通过 Nuget 包管理器安装的 type
是
Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync
也应该安装 SessionState.SessionStateModule。如果您是第一次将它安装到您的项目中,它会在您的 web.config
中为您创建一个 <sessionState>
模板。下面是如何使用它的示例:
<connectionStrings configBuilders="CS_Environment">
<add name="SQLSession_Connection" providerName="System.Data.SqlClient" connectionString="SQLSessionProvider-configBuilder_failed" />
</connectionStrings>
<sessionState cookieless="false" regenerateExpiredSessionId="true" mode="Custom" customProvider="SqlSessionStateProviderAsync">
<providers>
<add name="SqlSessionStateProviderAsync" connectionStringName="SQLSession_Connection" type="Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync, Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</providers>
</sessionState>