Library tutorials & articles
Using SQL Server for ASP.NET session state
- Getting Started
- Configuration
- Caveats
Caveats
Timeouts under heavy load
If your web servers are under heavy load it may be useful to increase the time out for session state access. You can add the stateNetworkTimeout attribute to the sessionState settings in web.config and machine.config
<sessionState stateNetworkTimeout="15" />
If a Web server or a state server is under stress and cannot complete session accesses on time, event ID 1072 and event ID 1076 may be logged in the event log.
Caveats when using SQL session state
Using SQL is slower than using InProc session state. When storing basic data types (string, int, etc), ASP.Net can take 10%-25% longer to store their values. Complex types take even longer. Of course because you are connecting to a separate server it does use bandwidth on your network.
When using SQL Server mode, objects stored in session state are serialised and deserialised when a request is processed. So any objects which do not support serialisation cannot be stored in session state. In ASP.Net v1.0 a bug means that attempting to store a non-serialisable object does not throw an error, and so will probably pass unnoticed.
For session state to be maintained across different web servers in a web farm (the main reason for moving session state to SQL), the Application Path of the website (For example \LM\W3SVC\2) in the IIS Metabase should be identical in for all the web servers in the web farm. Microsoft's KB 325056 details this problem.
If you wish to persist session state through SQL server reboots you must follow the instructions in KB 311209 to move the session state tables from tempdb to the ASPState database.
Other resources
Peter Bromberg's Session State FAQ
KB 317604 HOW TO: Configure SQL Server to Store ASP.NET Session State
Related articles
Related discussion
-
High-Performance .NET Application Development & Architecture
by Manjot Bawa (0 replies)
-
User does not have permission to perform this action error
by James Crowley (6 replies)
-
Incorrect syntax near 'Calculation'.
by ramdhavepreetam (3 replies)
-
VS.NET/sql server installation problem
by daspeac (4 replies)
-
Research topic in software
by reachsangeethamathew (0 replies)
Related podcasts
-
Using SQL Tracking Services with WF
Welcome to the latest video in the weekly WF/WCF Screencast series. In this short video, CSD MVP Matt Milner from PluralSight guides the viewer through how to add tracking capabilities to your WF using SQL Tracking Services. In this screencast, Matt demonstrates how to add SQL Server workflow t...
Events coming up
-
Mar
15
DevWeek 2010
London, United Kingdom
DevWeek is Europe’s leading independent conference for software developers, database professionals and IT architects, and features expert speakers on a wide range of topics, including .NET 4.0, Silverlight 3, WCF 4, Visual Studio 2010, REST, Windows Workflow 4, Thread Synchronization, ASP.NET 4.0, SQL Server 2008 R2, LINQ, Unit Testing, CLR & C# 4.0, .NET Patterns, WPF 4, F#, Windows Azure, ADO.NET, Entity Framework, Debugging, T-SQL Tips & Tricks, and more.
NCache is an extremely fast in-memory distributed cache for .NET. It also provides a highly reliablel (thru replication) and scalable ASP.NET Session State storage. Check it out at http://www.alachisoft.com
This thread is for discussions of Using SQL Server for ASP.NET session state.