Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 81367f8

Browse files
committed
README update for aspnet-session-state
1 parent 0c303e1 commit 81367f8

1 file changed

Lines changed: 8 additions & 47 deletions

File tree

  • samples/applications/aspnet-session-state

samples/applications/aspnet-session-state/README.md

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
# ASP.NET Session State with SQL Server 2016
2-
We are excited to offer two new SQL Server scripts (with and without retry-logic) to be used with the ASP.NET Session State provider!
1+
# ASP.NET Session State with SQL Server In-Memory OLTP
2+
ASP.NET session state enables you to store and retrieve values for a user as the user navigates the different ASP.NET pages that make up a Web application. Currently, ASP.NET ships with three session state providers that provide the interface between Microsoft ASP.NET’s session state module and session state data sources:
3+
- InProcSessionStateStore, which stores session state in memory in the ASP.NET worker process
4+
- OutOfProcSessionStateStore, which stores session state in memory in an external state server process
5+
- **SqlSessionStateStore**, which stores session state in Microsoft SQL Server database
36

4-
The scripts take advantage of memory optimized tables and natively compiled stored procedures to create the necessary database objects that the ASP.NET session state provider requires when SQL Server is used as a storage option for session data. These scripts are based on work from early adopters that modified their SQL Server objects to take advantage of In-Memory OLTP for ASP.NET session state, with great success. To learn more, read the bwin.party case study [Gaming site can scale to 250,000 requests per second and improve player experience](https://www.microsoft.com/danmark/cases/Microsoft-SQL-Server-2014/bwin.party/Gaming-Site-Can-Scale-to-250-000-Requests-Per-Second-and-Improve-Player-Experience/710000003117).
5-
6-
**This is the recommended way to implement ASP.NET session state with SQL Server 2016**.
7+
We are focusing on the SqlSessionStateStore provider and describe how you can configure it to use SQL Server In-Memory OLTP as the storage option for session data. You can either use the [latest ASP.NET async version of the SQL Session State provider](https://www.nuget.org/packages/Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync/) **(which is the recommended approach)**, or configure an earlier version of the provider to work with In-Memory OLTP by downloading and running the In-Memory OLTP SQL scripts from our sql server samples github repo.
78

9+
Please visit this blog post: https://blogs.msdn.microsoft.com/sqlserverstorageengine/2017/11/28/asp-net-session-state-with-sql-server-in-memory-oltp/ for details on how you can get started.
810

911
### Contents
1012

@@ -37,55 +39,14 @@ The scripts take advantage of memory optimized tables and natively compiled stor
3739

3840
<a name=install-scripts></a>
3941

40-
## Install Scripts
42+
## T-SQL Scripts
4143
There are two versions of the SQL Server script (with retry logic and without):
4244

4345
- [aspstate_sql2016 (no retry logic)](https://github.com/Microsoft/sql-server-samples/blob/master/samples/applications/aspnet-session-state/aspstate_sql2016_no_retry.sql)
4446
- [aspstate_sql2016 (with retry logic)](https://github.com/Microsoft/sql-server-samples/blob/master/samples/applications/aspnet-session-state/aspstate_sql2016_with_retry.sql)
4547

4648
Based on your workload characteristics and the way your application handles session state you have to decide if retry logic is needed or not. [This](https://msdn.microsoft.com/en-us/library/mt668435.aspx) article explains the logic used to detect conflict and implement retry logic in the script. Currently, the two memory-optimized tables: **dbo.ASPStateTempApplications** and **dbo.ASPStateTempSessions** in both of the scripts are created with **DURABILITY = SCHEMA_ONLY** meaning that in a case of a SQL Server restart or a reconfiguration occurs in an Azure SQL Database, the table schema persists, but data in the table is lost. If durability of both schema and data is required tthe script needs to be altered and the two tables above need to be created with: **DURABILITY=SCHEMA\_AND\_DATA**.[This](https://msdn.microsoft.com/en-us/library/dn553122.aspx) article explains the two durability options for memory-optimized tables
4749

48-
Note: Although both of these scripts have been tested, we always recommend executing your own testing and validation to understand how these scripts behave in your specific environment.
49-
50-
Follow the steps below to configure SQL Server 2016 In-Memory OLTP to store ASP.NET Session State:
51-
52-
1. Follow [this](https://support.microsoft.com/en-us/kb/317604) link to configure SQL Server to Store ASP.NET Session State
53-
2. Open the script in SQL Server Management Studio ([Download Link](https://support.microsoft.com/en-us/kb/317604))
54-
3. Connect to the SQL Server that you want to use.
55-
4. Execute (F5)
56-
57-
The script should execute with no errors and should create the **ASPState** database with the following objects:
58-
59-
Tables:
60-
-
61-
- dbo.ASPStateTempApplications
62-
- dbo.ASPStateTempSessions
63-
64-
Stored Procedures
65-
-
66-
- dbo.TempGetStateItemExclusive3
67-
- dbo.TempInsertStateItemShort
68-
- dbo.TempUpdateStateItemLong
69-
- dbo.TempUpdateStateItemLongNullShort
70-
- dbo.TempUpdateStateItemShort
71-
- dbo.CreateTempTables
72-
- dbo.DeleteExpiredSessions
73-
- dbo.GetHashCode
74-
- dbo.GetMajorVersion
75-
- dbo.TempGetAppID
76-
- dbo.TempGetStateItem
77-
- dbo.TempGetStateItem2
78-
- dbo.TempGetStateItem3
79-
- dbo.TempGetStateItemExclusive
80-
- dbo.TempGetStateItemExclusive2
81-
- dbo.TempGetVersion
82-
- dbo.TempInsertStateItemLong
83-
- dbo.TempInsertUninitializedItem
84-
- dbo.TempReleaseStateItemExclusive
85-
- dbo.TempRemoveStateItem
86-
- dbo.TempResetTimeout
87-
- dbo.TempUpdateStateItemShortNullLong
88-
8950
<a name=sample-details></a>
9051

9152
## Disclaimers

0 commit comments

Comments
 (0)