You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Readme.md
+15-78Lines changed: 15 additions & 78 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,9 @@ SessionStateModule is ASP.NET’s default session-state handler which retrieves
9
9
## How to contribute
10
10
Information on contributing to this repo is in the [Contributing Guide](CONTRIBUTING.md).
11
11
12
-
## Replace the existing Session module in `web.config`
13
-
14
-
Before you can specify one of these custom providers. You need to remove the existing session state module from your web.config file. In addition, you must register the new module to take its place.
15
-
16
-
```
12
+
## How to use
13
+
1. Update your web.config to remove the old session state module and register the new one:
14
+
```xml
17
15
<system.webServer>
18
16
<modules>
19
17
<!-- remove the existing Session state module -->
@@ -22,78 +20,17 @@ Before you can specify one of these custom providers. You need to remove the exi
*How to use* - Add ```<add key="aspnet:RequestQueueLimitPerSession" value="[int]"/>``` into web.config under appSettings section.
33
-
34
-
*Description* - If multiple requests with same sessionid try to acquire sessionstate concurrently, asp.net only allows one request to get the sessionstate. This causes performance issues if there are too many requests with same sessionid and a request doesn't release sessionstate fast enough, as asp.net starts a timer for each of this request to acquire sessionstate every 0.5 sec by default. This is even worse, if out-proc sessionstate provider is used. Because this can potentially use most of the out-proc storage connection resources. With this setting, asp.net will ends the request after the number of concurrent requests with same sessionid reaches the configured number.
*How to use* - Add ```<add key="aspnet:AllowConcurrentRequestsPerSession" value="[bool]"/>``` into web.config under appSettings section.
39
-
40
-
*Description* - If multiple requests with same sessionid try to acquire sessionstate concurrently, asp.net only allows one request to get the sessionstate. With this setting, asp.net will allow multiple requests with same sessionid to acquire the sessionstate, but it doesn't guarantee thread safe of accessing sessionstate.
The specific settings available for the new session state module and providers are detailed in their respective doc pages.
52
32
53
-
1.*UseInMemoryTable* - Indicates whether to use Sql server 2016 In-Memory OLTP for sessionstate. You can find more details about using In-memory table for sessionstate [on this blog](https://blogs.msdn.microsoft.com/sqlcat/2016/10/26/how-bwin-is-using-sql-server-2016-in-memory-oltp-to-achieve-unprecedented-performance-and-scale/).
54
-
55
-
2.*MaxRetryNumber* - The maximum number of retrying executing sql query to read/write sessionstate data from/to Sql server. The default value is 10.
56
-
57
-
3.*RetryInterval* - The interval between the retry of executing sql query. The default value is 0.001 sec for in-memorytable mode. Otherwise the default value is 1 sec.
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
75
-
*partitionKeyPath* and *partitionNumUsedByProvider* below.
76
-
77
-
1.*cosmosDBEndPointSettingKey* - The appsetting key name which points to a CosmosDB end point
78
-
79
-
2.*cosmosDBAuthKeySettingKey* - The appsetting key name which points to a CosmosDB auth key
80
-
81
-
3.*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.
82
-
83
-
4.*connectionMode* - Direct | Gateway
84
-
85
-
5.*connectionProtocol* - Https | Tcp
86
-
87
-
6.*requestTimeout* - The request timeout in seconds when connecting to the Azure DocumentDB database service.
88
-
89
-
7.*maxConnectionLimit* - maximum number of concurrent connections allowed for the target service endpoint in the Azure DocumentDB database service.
90
-
91
-
8.*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.
92
-
93
-
9.*maxRetryWaitTimeInSeconds* - The maximum retry time in seconds for the Azure DocumentDB database service.
94
-
95
-
10.*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"
96
-
97
-
11.*partitionKeyPath* - The name of the key to use for logically partitioning the collection. This key name should be different from 'id' unless "wildcard" partitioning is being used.
98
-
99
-
12.*partitionNumUsedByProvider* - The number of partition can be used for sessionstate. This was designed with the thought that multiple Cosmos partitions would be an extra cost. CosmosDB as it stands today encourages as many diverse logical partitions as you can imagine, as more partitions allow for better horizontal scaling. Setting this to an integer value will effectively reduce the partition count to 32 or less, even if the specified value is much greater. This is a result of how session ID's were translated to partition ID's by this provider. ***It is now recommended to specify "\*" for this option if possible.*** This will reuse the full session ID for partitioning, allowing Cosmos maximum ability for horizontal scaling.
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.
3
+
4
+
Before you can specify this new async providers, you need to setup the new async SessionStateModule as [described here](https://github.com/aspnet/AspNetSessionState/blob/main/docs/SessionStateModule.md).
> 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.
20
+
21
+
## Settings for Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync
22
+
1.*cosmosDBEndPointSettingKey* - The appsetting key name which points to a CosmosDB end point
23
+
24
+
2.*cosmosDBAuthKeySettingKey* - The appsetting key name which points to a CosmosDB auth key
25
+
26
+
3.*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.
27
+
28
+
4.*connectionMode* - Direct | Gateway
29
+
30
+
5.*connectionProtocol* - Https | Tcp
31
+
32
+
6.*requestTimeout* - The request timeout in seconds when connecting to the Azure DocumentDB database service.
33
+
34
+
7.*maxConnectionLimit* - maximum number of concurrent connections allowed for the target service endpoint in the Azure DocumentDB database service.
35
+
36
+
8.*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.
37
+
38
+
9.*maxRetryWaitTimeInSeconds* - The maximum retry time in seconds for the Azure DocumentDB database service.
39
+
40
+
10.*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"
41
+
42
+
11.*partitionKeyPath* - The name of the key to use for logically partitioning the collection. This key name should be different from 'id' unless "wildcard" partitioning is being used.
43
+
44
+
12.*partitionNumUsedByProvider* - The number of partition can be used for sessionstate. This was designed with the thought that multiple Cosmos partitions would be an extra cost. CosmosDB as it stands today encourages as many diverse logical partitions as you can imagine, as more partitions allow for better horizontal scaling. Setting this to an integer value will effectively reduce the partition count to 32 or less, even if the specified value is much greater. This is a result of how session ID's were translated to partition ID's by this provider. ***It is now recommended to specify "\*" for this option if possible.*** This will reuse the full session ID for partitioning, allowing Cosmos maximum ability for horizontal scaling.
SessionStateModule is ASP.NET’s default session-state handler which retrieves session data and writes it to the session-state store. It already operates asynchronously when acquiring the request state, but it doesn’t support async read/write to the session-state store. In the .NET Framework 4.6.2 release, we introduced a new interface named ISessionStateModule to enable this scenario. You can find more details on [this blog post](https://blogs.msdn.microsoft.com/webdev/2016/09/29/introducing-the-asp-net-async-sessionstate-module/).
3
+
4
+
Before you can specify one of these custom providers. You need to remove the existing session state module from your web.config file. In addition, you must register the new module to take its place.
*How to use* - Add ```<add key="aspnet:RequestQueueLimitPerSession" value="[int]"/>``` into web.config under appSettings section.
21
+
22
+
*Description* - If multiple requests with same sessionid try to acquire sessionstate concurrently, asp.net only allows one request to get the sessionstate. This causes performance issues if there are too many requests with same sessionid and a request doesn't release sessionstate fast enough, as asp.net starts a timer for each of this request to acquire sessionstate every 0.5 sec by default. This is even worse, if out-proc sessionstate provider is used. Because this can potentially use most of the out-proc storage connection resources. With this setting, asp.net will ends the request after the number of concurrent requests with same sessionid reaches the configured number.
*How to use* - Add ```<add key="aspnet:AllowConcurrentRequestsPerSession" value="[bool]"/>``` into web.config under appSettings section.
27
+
28
+
*Description* - If multiple requests with same sessionid try to acquire sessionstate concurrently, asp.net only allows one request to get the sessionstate. With this setting, asp.net will allow multiple requests with same sessionid to acquire the sessionstate, but it doesn't guarantee thread safe of accessing sessionstate.
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.
3
+
4
+
Before you can specify this new async providers, you need to setup the new async SessionStateModule as [described here](https://github.com/aspnet/AspNetSessionState/blob/main/docs/SessionStateModule.md).
## Settings for Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync
16
+
1.*UseInMemoryTable* - Indicates whether to use Sql server 2016 In-Memory OLTP for sessionstate. You can find more details about using In-memory table for sessionstate [on this blog](https://blogs.msdn.microsoft.com/sqlcat/2016/10/26/how-bwin-is-using-sql-server-2016-in-memory-oltp-to-achieve-unprecedented-performance-and-scale/).
17
+
18
+
2.*MaxRetryNumber* - The maximum number of retrying executing sql query to read/write sessionstate data from/to Sql server. The default value is 10.
19
+
20
+
3.*RetryInterval* - The interval between the retry of executing sql query. The default value is 0.001 sec for in-memorytable mode. Otherwise the default value is 1 sec.
Copy file name to clipboardExpand all lines: src/packages/CosmosDBSessionStateProviderAsync.nupkg/Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.nuproj
Copy file name to clipboardExpand all lines: src/packages/CosmosDBSessionStateProviderAsync.nupkg/Microsoft.AspNet.SessionState.CosmosDBSessionStateProviderAsync.nuspec
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -11,9 +11,11 @@
11
11
<summary>Async version CosmosDBSessionState provider</summary>
0 commit comments