Skip to content

Commit 92be0b5

Browse files
authored
Merge branch 'master' into master
2 parents 1397b37 + 3d2eeba commit 92be0b5

File tree

40,049 files changed

+3103906
-37442
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

40,049 files changed

+3103906
-37442
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ samples/databases/wide-world-importers/workload-drivers/vehicle-location-insert/
4545
samples/features/in-memory/ticket-reservations/DemoWorkload/bin/Debug/DemoWorkload.vshost.exe.config
4646
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Release/DemoWorkload.Properties.Resources.resources
4747
samples/databases/wide-world-importers/wwi-integration-etl/Daily ETL/obj/Development/Project.params
48+
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Debug/DemoWorkload.csproj.FileListAbsolute.txt
49+
samples/features/in-memory/iot-smart-grid/Db/obj/Release/Model.xml
50+
samples/applications/iot-smart-grid/DataGenerator/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
155 KB
Loading

media/demos/ivs-symbols.png

79.4 KB
Loading
998 KB
Loading

samples/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ __[applications] (applications/)__
44

55
End-to-end sample applications that illustrate the use of SQL Server for specific application scenarios.
66

7-
__[connect] (connect/)__
8-
9-
Samples showing how to connect to SQL databases using various programming languages, including Python, C#, Java, Ruby, and Node.js.
10-
117
__[databases] (databases/)__
128

139
Sample databases for SQL Server, Azure SQL Database, and Azure SQL Data Warehouse.
@@ -23,3 +19,7 @@ Samples illustrating specific SQL Server and Azure SQL Database features, includ
2319
__[management] (manage/)__
2420

2521
Samples that help with the management of SQL Server and Azure SQL Database.
22+
23+
__[tutorials] (tutorials/)__
24+
25+
Samples showing how to connect to SQL databases using various programming languages, including Python, C#, Java, Ruby, Node.js, and PHP.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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!
3+
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+
8+
9+
### Contents
10+
11+
[About this sample](#about-this-sample)<br/>
12+
[Before you begin](#before-you-begin)<br/>
13+
[Install scripts](#install-scripts)<br/>
14+
[Disclaimers](#disclaimers)<br/>
15+
[Related links](#related-links)<br/>
16+
17+
<a name=about-this-sample></a>
18+
19+
## About this sample
20+
21+
1. **Applies to:** SQL Server 2016 (or higher) Enterprise / Developer / Evaluation Edition, Azure SQL Database (Premium)
22+
2. **Key features:**
23+
- ASP.NET Session State Provider
24+
- Memory Optimized Tables
25+
- Natively Compiled Stored Procedures
26+
4. **Programming Language:** T-SQL
27+
5. **Authors:** Perry Skountrianos [perrysk-msft]
28+
29+
<a name=before-you-begin></a>
30+
31+
## Before you begin
32+
33+
**Software prerequisites:**
34+
35+
1. SQL Server 2016 (or higher) Enterprise / Developer / Evaluation Edition or Azure SQL Database (Premium)
36+
2. .NET Framework 2.0 or higher
37+
38+
<a name=install-scripts></a>
39+
40+
## Install Scripts
41+
There are two versions of the SQL Server script (with retry logic and without):
42+
43+
- [aspstate_sql2016 (no retry logic)](https://github.com/Microsoft/sql-server-samples/blob/master/samples/applications/aspnet-session-state/aspstate_sql2016_no_retry.sql)
44+
- [aspstate_sql2016 (with retry logic)](https://github.com/Microsoft/sql-server-samples/blob/master/samples/applications/aspnet-session-state/aspstate_sql2016_with_retry.sql)
45+
46+
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
47+
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+
89+
<a name=sample-details></a>
90+
91+
## Disclaimers
92+
The code included in this sample is not intended to be a set of best practices on how to build scalable enterprise grade applications. This is beyond the scope of this quick start sample.
93+
94+
<a name=related-links></a>
95+
96+
## Related Links
97+
<!-- Links to more articles. Remember to delete "en-us" from the link path. -->
98+
99+
For more information, see these articles:
100+
101+
- [In-Memory OLTP (In-Memory Optimization)](https://msdn.microsoft.com/en-us/library/dn133186.aspx)
102+
- [OLTP and database management](https://www.microsoft.com/en-us/server-cloud/solutions/oltp-database-management.aspx)
103+
- [Session State Provider](https://msdn.microsoft.com/en-us/library/aa478952.aspx)
104+
- [Implementing a Session-State Store Provider](https://msdn.microsoft.com/en-us/library/ms178587.aspx)
152 KB
Binary file not shown.
178 KB
Binary file not shown.
-6.22 MB
Binary file not shown.

samples/applications/iot-smart-grid/WinFormsClient/FrmMain.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)