Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync
2.0.0
Prefix Reserved
dotnet add package Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync --version 2.0.0
NuGet\Install-Package Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync -Version 2.0.0
<PackageReference Include="Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync" Version="2.0.0" />
paket add Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync --version 2.0.0
#r "nuget: Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync, 2.0.0"
// Install Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync as a Cake Addin #addin nuget:?package=Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync&version=2.0.0 // Install Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync as a Cake Tool #tool nuget:?package=Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync&version=2.0.0
Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync
In .Net 4.6.2, asp.net enables developer plug in async version of SessionState module which is a good fit for the non-in-memory SessionState data store. This SessionState provider uses SQL Server as the data store and leverages async database operation to provide better scability.
Before you can specify this new async providers, you need to setup the new async SessionStateModule as described here.
Then, register your new provider like so:
<sessionState cookieless="false" regenerateExpiredSessionId="true" mode="Custom" customProvider="CosmosDBSessionStateProviderAsync">
<providers>
<add name="CosmosDBSessionStateProviderAsync" cosmosDBEndPointSettingKey="cosmosDBEndPointSetting" cosmosDBAuthKeySettingKey="cosmosDBAuthKeySetting"
databaseId="[DataBaseId]" collectionId="[CollectionId]" offerThroughput="5000" connectionMode="Direct" requestTimeout="5" skipKeepAliveWhenUnused="false"
maxConnectionLimit="50" maxRetryAttemptsOnThrottledRequests="10" maxRetryWaitTimeInSeconds="10" consistencyLevel="Session" preferredLocations=""
type="Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync, Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</providers>
</sessionState>
Note For the best scalability, it is recommended to configure your CosmosDB provider with "wildcard" partitioning. For update-compatibility purposes, this is not the default. Please read about partitionKeyPath and partitionNumUsedByProvider below.
Settings for Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync
cosmosDBEndPointSettingKey - The appsetting key name which points to a CosmosDB end point
cosmosDBAuthKeySettingKey - The appsetting key name which points to a CosmosDB auth key
offerThroughput - The offer throughput provisioned for a collection in measurement of Requests-per-Unit in the Azure DocumentDB database service. If the collection provided doesn't exist, the provider will create a collection with this offerThroughput. If set to "0", collection will be set to use the default throughput of the database.
connectionMode - Direct | Gateway
requestTimeout - The request timeout in seconds when connecting to the Azure DocumentDB database service.
skipKeepAliveWhenUnused - This setting will skip the call to update expiration time on requests that did not read or write session state. The default is "false" to maintain compatibility with previous behavior. But certain applications (like MVC) where there can be an abundance of requests processed that never even look at session state could benefit from setting this to "true" to reduce the use of and contention within the session state store. Setting this to "true" does mean that a session needs to be used (not necessarily updated, but at least requested/queried) to stay alive.
maxConnectionLimit - maximum number of concurrent connections allowed for the target service endpoint in the Azure DocumentDB database service.
maxRetryAttemptsOnThrottledRequests - the maximum number of retries in the case where the request fails because the Azure DocumentDB database service has applied rate limiting on the client.
maxRetryWaitTimeInSeconds - The maximum retry time in seconds for the Azure DocumentDB database service.
consistencyLevel - The Consistency Level to use with the CosmosClient. Default is the Cosmos SDK default, which is currently 'Session'.
preferredLocations - Sets the preferred locations(regions) for geo-replicated database accounts in the Azure DocumentDB database service. Use ';' to split multiple locations. e.g. "East US;South Central US;North Europe"
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- Microsoft.AspNet.SessionState.SessionStateModule (>= 2.0.0)
- Microsoft.Azure.Cosmos (>= 3.23.0)
- System.Text.Json (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.0 | 5,968 | 6/15/2023 |
2.0.0-preview1 | 227 | 4/12/2023 |
1.1.0 | 23,101 | 6/19/2019 |
1.0.0 | 17,976 | 11/15/2017 |