Is there is a quick, cheap, reliable session-state mechanism available for Free F1 WebApp ASP.NET for demonstration configurations?
I know Windows Azure Session management is discussed a lot on SO, but this particular configuration issue seems to slip through the cracks.
The available configuration options seem to be:
InProc mode: Not recommended in the cloud but for a single instance Azure F1 WebApp it should, in theory, be reliable for demonstration websites. However, my experience is that the sessions time out unpredictably and have no bearing on the settings in the web.config file.
Azure Redis Cache: Recommended but not supported for Free F1 WebApps; an upgrade to paid plan is required. (Reference: https://azure.microsoft.com/en-gb/pricing/details/cache/)
Azure SQL: Not recommended or supported. ** This would seem to be a viable option if you already have an Azure SQL server running. Reference: https://azure.microsoft.com/en-gb/blog/using-sql-azure-for-session-state/ . Unfortunately I have found the amended InstallSqlState.sql impossible to find and all links to downloads fail (Example: https://support.microsoft.com/en-us/kb/2006191). ** Universal Web Providers may offer a solution (Refernce:http://www.hanselman.com/blog/IntroducingSystemWebProvidersASPNETUniversalProvidersForSessionMembershipRolesAndUserProfileOnSQLCompactAndSQLAzure.aspx) but it is unclear - at least to me - whether these offer Session management support as well as SQL Server connection support.
Azure Table Storage: A potential option, but seems to be an out-of-date solution as all links are broken. (Reference:https://www.simple-talk.com/cloud/platform-as-a-service/managing-session-state-in-windows-azure-what-are-the-options/). I've never used Azure Tables so this seems esoteric.
StateServer: Not possible with a Free F1 webapp. Presumably a virtual machine would be required.
Custom: Yes, this would work. **Redis Cache is a custom session manager, so I presume another one could be used. **The alternative AppFabric (Reference: ASP.NET session state provider in Azure) no longer seems to be supported and was a paid solution. **Perhaps there is an alternative custom solution available I haven't researched yet.
Azure Cache Service and Role Based Cache: Retired November 30, 2016.(Reference:https://azure.microsoft.com/en-gb/documentation/articles/cache-faq/#which-azure-cache-offering-is-right-for-me).
The bottom line seems to me that there isn't. I would really appreciate it if someone could prove otherwise.
EDIT:
I've been thinking about and tinkering with this throughout the day. My findings so far are:
1) Upgrading to the D1 WebApp service plan improves the reliability of the session-state management considerably but it is still prone to unpredictability. As Hrvoje Hudo points out below you can't expect reliability with Free or Shared.
2) Installing ASP.NET Universal Providers would seem to be a solution. I created a new MVC WebApp project using MSVC2013, selected Azure hosting, typed:
install-package Microsoft.Aspnet.Providers
in the package management console, added: Session["Time"]=DateTime.Now.ToString() to the Home Index view and referenced it in the about View using:
ViewBag.Message = Session["Time"]
And updated the web.config to:
<sessionState mode="Custom" customProvider="DefaultSessionProvider" timeout="1">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=Whatever" connectionStringName="DbaseName"/>
</providers>
</sessionState>
When I publish the website the default database is created on my Azure SQL Server, courtesy of the publish scripts.json containing all my config settings and swapping them in, and a dbo,session table is created on the database.
Browsing to the website, new sessions are created on the database table - I can see them using MS Management Studio 2013 - and deleted after they time out (60s+).
I downgraded the website to Free (to be sure it wasn't configured to a higher plan by default, which MSVC used to do) and everything still seems to work. This seems to be what I was looking for.
3) Azure Tables. Can't get my head around these yet! If anyone knows of a good "how to" tutorial I'd love to look at it.
EDIT 2:
After a day's soak testing I'm now 90% convinced ASP.NET Universal Providers is the way to go for quick & reliable sessions using a Free Azure Web App. I can't says it's free, as the SQL Server must be paid for (Basic = ~£4pm See: https://azure.microsoft.com/en-gb/pricing/details/sql-database/) , but it's certainly not expensive, and if you're using an SQL Server anyway - like me - it makes sense.