Unable to use Session State Server

Issue

ASP.NET site running under .NET 2.0 has the following setting in web.config:

<sessionState mode="StateServer" stateNetworkTimeout="10" 
cookieless="false" timeout="30"/>

When the application attempts to use the session cache, the following exception is thrown:

HttpException (0x80004005): Unable to use session state server because this version of ASP.NET requires session state server version 2.0 or above.

This exception occurs the very first time the session cache is used after the application is published to the server, after IIS is restarted, or after the application pool recycles.  Subsequent uses of the session cache after the first exception is thrown do not result in an error.  The session cache continues to work properly until the next application re-publish, IIS restart, or application pool recycle.

Cause

ASP.NET State server uses HTTP Requests to manage the session state requests.  When sending the response back to the Web application the state server should be including a header":

X-ASPNet-Version: 2.xxxx header

The Session State Server reads this header, and checks to see if the major version is < 2, if so it will throw the exception.

In one case we had with a customer, the header is never being returned.  It is never being returned because in the <httpRuntime> Configuration section they had:

enableVersionHeader = “false”.

Now, why did this only happen for the first request?  Well, in the very first request to our state server, we check to see if we already know the state server version by comparing to -1. If not, we check the version during the response.  While we are checking the version upon response we set the version to 0 which prevents us from checking the version ever again, since it isn’t -1.

kick it on DotNetKicks.com

Published 14 July 08 06:00 by Tom

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# a-foton &raquo; Unable to use Session State Server said on July 14, 2008 6:19 AM:

PingBack from http://blog.a-foton.ru/2008/07/unable-to-use-session-state-server/

Leave a Comment

(required) 
(optional)
(required) 

Search

Go

This Blog

Syndication

Page view tracker