My development machine is getting unstable. So I decided to reload my computer from scratch.
One of the tasks is to install ASPState to ASP.Net applications. It’s been a long time I install ASP.Net. And I’m repeating the same old mistake I made years ago.
I run this command:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regsql.exe
That program guides me through a wizard. And it installs aspnetdb database on my machine.
But when I execute my ASP.net from Visual Studio, I get this error message:
Cannot open database requested in login ‘ASPState’. Login fails. Login failed for user ‘???’.
Hmm, that’s puzzling. I spent an hour finding out the error, and it turns out I need to run the command this way.
aspnet_regsql.exe -ssadd -sstype p -E
The wizard in aspnet_regsql.exe does not support for ASPState. I must add these parameters to create another database called ASPState.
Things are looking good. Well, almost. I got another error message when I run the ASP.Net application.
EXECUTE permission denied on object ‘GetMajorVersion’, database ‘ASPState’, owner ‘dbo’.
This is obvious to me. And the solution is simple. I must grant the database access to ASPState to appropriate users, and grant stored procedure in database ASPState EXEC permission to these users.
Here’s my lesson.
- Write down note just to remind myself. I went through this problem before, and I totally forget all these details. If I spent time to write it down, I don’t have to go through the pain twice.
Here’s interesting link related to ASPState
- HOW TO: Configure SQL Server to Store ASP.NET Session State — don’t use the SQL script described in the article. When I read the SQL script, the SQL comment recommends using aspnet_regsql.exe
- ASP.NET Session State
- Understanding session state modes + FAQ
- HOW TO: Configure ASP.NET for Persistent SQL Server Session State Management
- Improving ASP.NET Session State database performance by reducing blocking
- ASPNETDB + Production deployment –> Practical Tips