Table Storage Session Provider for Azure is now obsolete, easiest option – Sql Server

While migrating my legacy web application(Upgraded to framework 4.5 from .net 1.1) to Windows Azure, I found that application session was getting expired very frequently even not retaining it for 20 minutes, default for a web application. When I checked the config, found that session mode is Inproc. Azure does not support inproc as with load balancer azure uses round robin allocation across multiple instances. So, I explored few session storage options and now sharing my experience here. Before moving ahead, I would like to share my azure version too. I have latest 2.4 SDK for Azure with VS2013.

TableStorageSessionProvider : Initially my first choice was to use Table storage as it was looking very easy to implement. By following all mentioned steps in different blogs and articles, I found that everywhere reference of same article(above link) has been given. During my implementation I found that updated azure does not support Table Storage Session Provider sample code /dll  as this dll version is obsolete for now and there is no new update on it..

In very beginning of 2010-2011 Microsoft Azure team has provided a sample project dll/code to use it and every blog/article mentioned it. Here is the link

Unfortunately, till now there is no support for it , even now, they have removed the link from msdn. So I suggest, don’t waste time on it as I did 🙂 . Below is a brief regarding it:

I . After implementing it, code was running correctly with emulator but when I moved my application on Azure, it didn’t resolved my session issue and throwing some run time error . Even after spending my several hours nothing was fruitful. What all I understood is that error was due to compatibility of  sample code with latest version of Azure. I posted my question in several blogs but still it is unanswered. Then I moved to try other options like Sql Session.

SqlServer the easiest option:  I found SqlServer the easiest option to keep session state in Azure. Only we need to install nuget package Package Microsoft.Aspnet.Providers  and then remove unused/unwanted additional settings like role, membership provider etc. from web.config.

if you want to use it, I would like to suggest a very good article by Kunal, Microsoft Azure MVP. Also, this is the blog which confirmed me about outdated Table Storage dll.


Things need to keep in mind while Migrating a SQL2008 db to SQL Azure

Couple of days ago, I got a chance to make a  SQL Server 2005 db to  Azure compatible. During it, I noticed couple of points  were very useful to prevent  errors while publishing db in Azure. There may be some tools for this but still I would like to share my experience. 🙂

Here are few points which a new generation db should follow
1. Every table must have a clusteredIndex :  Azure looks for a clustedIndex in every table. So make sure  your table has a clustered Index in it.

2.Not For Replication property: Need to remove Not For Replication property from table column- mostly it is with identity column

3. Avoid MS_Description: Ms description is a old property which is now obsolete. My db was designed in sql 2000 and then migrated to SQL2005. So at the start it has been used and this property was very helpful to to understand the columns details . But for Azure you need to  to remove MS_Description property from every table column

4.Avoid Fillfactor : Need to remove Fillfactor property from Indexes as Azure does not support it.

5. Avoid String literal : For column name like select ‘NAME’ = charge_Name ChargeType etc
instead use select [NAME] = charge_Name ChargeType etc

6. Avoid textpr datatype : does not support textpr datatype, we will nee to remove it from all sps

7. Apply WITH hint: Need to use WITH hint with nolock etc like SELECT PK_VISIT_ID FROM m_visit WITH (NOLOCK)

Hope it is worth to share 🙂