HELP in Session management in Table Storage
-
Montag, 12. März 2012 12:58
Hi,
I'm trying to implement Session Management in Table Storage using the TableStorageSessionStateProvider. I'm trying to cleanup the expired sessions using threads in the WebRole instead of the WorkerRole.
I have a few doubts. The Session data is being stored in blobs, but there is only one entry in the Session Table which reflects only the last blob entry.
How is the session table and blob container linked?
As soon as i launch the application, there is a blob already present in the container even before i add any data to session. What is that?
The code itself runs fine. I use the LastModifiedUTC property to check for expiry and delete the blobs like so:
var blobarr = container.ListBlobs();
foreach (CloudBlob blober in blobarr)
{
if (blober.Properties.LastModifiedUtc < DateTime.UtcNow.AddMinutes(-1))//Assuming one minute expiry timeout
{
Trace.WriteLine("Deleting " + blober.Properties.LastModifiedUtc.ToString() + "\n\n");
blober.Delete();
}
}
After all the session blobs have been cleaned up, of i try to add anything to session again, it shows a "blob not found" error.
Has anybody implemeted clearing of expired sessions in table storage?
Alle Antworten
-
Dienstag, 13. März 2012 06:47
TableStorageSessionStateProvider is not officially supported by Microsoft. You can use Windows Azure to store session data. There's a nice tutorial on http://msdn.microsoft.com/en-us/WAZPlatformTrainingCourse_BuildingAppsWithCacheService.Sining Oh Blue Star
- Als Antwort markiert Arwind - MSFTModerator Mittwoch, 21. März 2012 10:45
-
Dienstag, 13. März 2012 07:06
As SALX mentioned, using the TableStorageSessionStateProvider might not be the best solution to handle your application session state:
Some people suggest to use SQL Azure storage or the Windows Azure caching service to store session state reliably. See this msdn thread about the TableStorageSessionStateProvider:
http://social.msdn.microsoft.com/Forums/en-US/windowsazuredevelopment/thread/64675a13-c12d-4647-aa34-7f381261481e/Using the Windows Azure caching service is an ideal solution to store your session state to provide fast access to your session state for your application, using the local cache with the cache service.
You can find how to work with the Windows Azure caching service local cache here:
http://robbincremers.me/2012/02/23/using-windows-azure-caching-service-to-improve-performance-for-your-cloud-services/If you are looking to to use the TableStorageSessionStateProvider, then just ignore this post.
Be nice to nerds ... Chances are you'll end up working for one!
- Als Antwort markiert Arwind - MSFTModerator Mittwoch, 21. März 2012 10:45

