asp.net - Automatic fix for tempdb error related to 'ASPStateTempSessions' -


as per this how-to, i've configured iis on xp-sp3 dev box sql server 2008 express save asp.net session state information. i'm using sql server because otherwise on every recompile, losing session state obnoxious (having re-login). but, i'm facing annoying issue in every time restart sql there's error, , 1 or 2 other similar friends:

the select permission denied on object 'aspstatetempsessions', database 'tempdb', schema 'dbo'. 

to fix error, open management studio , edit user mapping login/dbo i'm using on aspstate db, , re-add tempdb user deny permissions. apparently, once right permissions there, asp.net able automatically create tables uses. can't run createtemptables sproc until right security there.

the question... there way not have re-do on every restart of sql server?

i don't care right keeping temp data across restarts, not have go through manual step web app working on localhost, uses session state variables throughout. suppose 1 resort kind of stored procedure within sql server accomplish task machine when service starts, not have manually. i'd accept such answer quick fix. but, i'm assuming there's better recommended configuration or something. not seeing answer on how-to guide or elsewhere here on stackoverflow.

both answers seem valid; things microsoft, in setup...

first uninstall aspstate database using command:

aspnet_regsql –ssremove –e -s .

note:

-e indicate want use integrated security connection.

-s informs sql server , sql instance use, , "." (dot) specifies default local instance

then re-install using command:

aspnet_regsql –ssadd –sstype p –e -s .

note:

the sstype has 3 options, t | p | c ... first "t", tells installer host stored procedures in aspstate database, , data in tempdb. second option "p" tells installer persist data aspstate database. last option "c" allows specify different 'custom' database persist session state data.

if reinstall using "-sstype p" need supply datareader/datawriter aspstate database user that's making connection (in cases, application pool's identity in iis).

the added benefit of persisting data session state retained after restart of service. drawback need ensure agent cleanup job pruning old sessions regularly (it default, every minute).

important:

if running cluster, must persist session data. you're option use sstype 'p' or 'c'.

hope sheds light on issue!


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -