Uncategorized

Unable to use SQL Server because ASP.NET version 2.0 Session State is not installed on the SQL server

I run across this error today while setting up a repro for a problem I’m working on; the first time I through I did something wrong between the mess of things which case across my hands today (maybe I’ve used the wrong .sql script? ?), but after removing the database from Sql Server and re-running correct InstallSqlState.sql, I got the same message once again ?.

Ok then, time for a (hopefully) quick research on this error and finally I found out a few things which might cause it.

Running  both ASP.NET and classic ASP in the same application pool?

If the application pool is also running classic ASP pages, and those classic ASP pages use .NET 2.0 components, and those classic ASP pages which use .NET components are called before any ASP.NET 1.1 page, then we’ll load CLR 2.0 (first come, first serve ?) and of course it will look for his specific ASPState version.

Ok, there are a lot of “if” in this case, but it’s still a possibility… not my scenario, through.

Where are your session tables?

If you use aspnet_regsql wizard, session tables are not added by default so you need to run the following command:

aspnet_regsql.exe -S <servername> -E -ssadd -sstype p

Again, that was not my case.

Are you sure you can run it?

Of course we still need permissions to access the database… so make sure the account used in your connection string can connect to the database has EXEC permission on the following stored procedures in ASPState database:

    • TempGetAppID
    • TempGetStateItem
    • TempGetStateItemExclusive
    • TempReleaseStateItemExclusive
    • TempInsertStateItemLong
    • TempInsertStateItemShort
    • TempUpdateStateItemLong
    • TempUpdateStateItemShort
    • TempUpdateStateItemShortNullLong
    • TempUpdateStateItemLongNullShort
    • TempRemoveStateItem
  • TempResetTimeout

Well… to make things easier in my sample, I just granted NETWORK SERVICE dbo permission on ASPState and I got my repro up an running.

Need self irony and a joke

What can I say? The error message is not very helpful in this situation (ok, it’s misleading ?), and this reminded me a joke I heard a few years ago before joining Microsoft… it’s something like the jokes we have in Italy against our Carabinieri (one of Italian police forces); but I warn you, I’m not a good storyteller…

There is a group of friends in trouble on their helicopter, the radio is broken, there is a thick fog and they don’t know where they are. Suddenly they see the shape of a skyscraper and try to attract the attention of people inside their offices; someone on the helicopter writer down on a peace of paper: “Radio broken, need help, where are we?”. Immediately the people inside the office start to talk each other and finally someone writes the answer on a sheet of paper: “You’re in an helicopter at about 30 feet from the ground, and in this foggy day you’d better stay at home”. The pilot of the helicopter at first looks puzzled, then smiles, nods thankfully and flight back to the airport where they land safely. Other passengers were amazed and asked the pilot how he had been able to find their way home so quickly
“Easy”, he replied “we were at Microsoft’s building”
“How did you know?”
“We asked a simple and direct question and they gave a vague and completely useless answer!”

P.s.
Ok, I told you I’m not a good storyteller…?

Carlo

Quote of the day:
I have a rock garden. Last week three of them died. – Richard Diran

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.