Azure (Free F1 WebApp) Session Management - asp.net

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.

There's no "silver bullet" session state, that's why you have all those options, chose what fits best with your requirement and business case. For Free web app you can't expect reliable service, Azure will restart your app pool regularly and there are lot of limits, so default InProc can be an issue - but again you're using Free tier. So since you want to save few bucks - invest time into writing your own, which uses Azure Storage (table or blob, I would use Table) or some other storage mechanism.

Related

Sessionless ASP.NET on Azure

We have a webform app that is ready for production. We found that SQL and Azure training kit's session state providers are not recommended for production code on Azure. We had no luck with TableStorageSessionProvider so far. Unfortunately, our client is not willing to pay for AppFabric Cache. Unless I'm misinformed I see no way to use AppFabric.
We do not use the session ourselves (removed all references to it), would you recommend disabling it or simply using the default provider?
Best regards,
Max
if you have no need for session, then it would be best to disable it. Default provider for session state is in memory of a single IIS server and you will likely have 2+ deployed in production. First it takes resources to keep it around, second it leaves an opening for someone in the future to accidentally use it during development w/o realizing overall implications.
HTH
Azure instances are not like any other IIS servers. In memory session data is NOT shared across multiple instances.
If you do not need session state, disable it. If you do, I would recommend checking out AppFabric Cache. We use the AppFabric Session state provider and it works great. If you're interested, this link will help get you started...
http://appfabricdemos.codeplex.com/releases/view/65427

Considering WebDeploy for internal cluster sites. Experiences?

We have recently started to use cluster servers in our company. I have done some reading on MS WebDeploy and the technology looks promising. Our requirements:
Create backups before deployment
Deploy to different servers
Test server
Two live clusters
Ability to stop application pools for specific web applications before publish and start them again afterward
Allowing limited access: In other words a developer may only publish to sites that they are responsible for
Possible customisation: We would like to disallow publishes if related bugs have not been solved in our bug tracker, and possibly more, like approvals from management. Can external customisations be done without losing VS integration
Visual Studio integration and the use of Web.config transforms
SQL Schema changes and especially stored procedures without affecting data
Our environment
IIS 7
Windows Server 2008
SQL Server 2005 (Planned move to 2008)
Visual Studio 2010
Based on my research it does seem that many of the above requirements have been met. What I would like to know is how reliable the solution is and whether the above requirements will be met. More importantly I would like to know what your personal experiences with webdeploy are and whether you would recommend it or whether there are better alternatives.
At the moment we are using file copying which proves to be unreliable (due to human error) and tedious.
We do about 80% of what your asking for using WebDeploy packaging and Thoughtworks GO! for orchestration of our release pipeline. It works really well. We have over a 100 websites/services and deploy something to production every four hours. The following post describes how we perform the deployment and links to related information:
http://www.dotnetcatch.com/2016/12/28/zero-downtime-clustered-deployment-of-webdeploy-packages-via-powershell/
One note, config transforms happen at build time which is problematic when you want to deploy to multiple environments. WebDeploy parameterization accomplishes the same result but is applied at deploy time. Check it out -
http://www.dotnetcatch.com/2014/09/08/parameterizationpreview-visual-studio-extension/

Communicating between ASP.NET applications on the same machine

I have a situation where information about a user is stored in the web application cache and when that information is updated in one application - I want to notify the other applications (running on the same machine) that the data should be removed from it's cache so it can be refreshed. Basically I need to keep cached data in sync across multiple asp.net applications.
I have started down the path of using a central web service to help coordinate the notifcations but it is turning out to be more complex than I think it needs to be.
Is there a way that one asp.net application can easily reach across to another on the same box to clear an item from the cache?
Is there a better way to achieve shared cached information than using the application cache?
I really want to create a way for apps to communicate in a loosely coupled way - I looked at nservice bus but the dependency on MSMQ scared me away - my client has had bad experiences with MSMQ and does not want to support an app that requires it.
Suggestions?
Michael
I agree with Hogan. Best is to use a shared database. I want to add to that that, when using SQL Server, you can use SQL Cache Dependency. This SQL Server mechanism allows notifications to applications in such a way that used caches can be invalided directly after a change is made to the data.
A shared database is probably going to cause you the least pain.
Edit
Note: ASP.NET allows you to make "cache clearing" triggers on SQL server changes. Should be a quick search in the cache examples on MSDN to find some examples. Thus when the user info stored in the cache changes in the DB the local cache copy will clear and be re-loaded from the DB.
There are commercial distributed caches available for .net other than Microsoft Velocity - NCache, Coherence, etc.
How about Velocity? It's a distributed cache that works between servers as well as between applications. It has PowerShell management and all sorts of documentation to get you going faster and be far more maintainable in the long-term.
What about COM/DCOM, using namespace System.Runtime.Remoting

Migrate Access to ASP.NET

The current application is a kind of CRM application built upon MS Access. The application is for internal use. My job is to migrate it to ASP.NET web-based application. Now boss requires to keep Access as database and develop ASP.NET code against it.
My question is, is there any disadvantages of using Access as database in ASP.NET application? (e.g. optimistic concurrency issue?) Should I persuade boss to upgrade Access to MS-SQL?
Many thanks!
We've used Access as a backend for web sites with good success. It's cheap, can be used effectively by moderately skilled programmers, and you can store the MDB on a document server so it gets backed up.
Most IT people dislike Access, but from a business perspective, Access can be very valuable.
MS Access is notoriously unstable in multiuser environments. A WEB app is by definition heavily multi-user.
So IMHO leaving MS Access as underlying DB is a call for trouble. At least use SQL Express (it is free)
The problem you are going to face in upgrading from Access to MS-SQL is that there is a major cost investment for the application. If your company already has the infrastructure in place(licensing, hardware...) then you won't have such a hard fight to pursuade your boss.
As for a technical answer:
I'd say you need to let you boss know that access databases aren't ideal for concurrent usage which a web application suggests is the intended goal of the application. My view is that Access is for database information that a SMALL set of users will be simply using for small data entry and querying. NEVER use Access to build an enterprise-level solution.
If you are planning to upgrade a Microsoft Access database to SQL Server 2008, use the SQL Server Migration Assistant (SSMA) rather than the upsizing wizard built into MS
10+ tips for upsizing an Access database to SQL ServerAccess.
Your boss probably likes to do ad-hoc stuff with access / excel. If you move the DB to SQL Server Express you can use Access and it's linked table feature to let your boss keep doing his ad-hoc needs through Access while keeping the data in SQL Server Express. If you keep the linked tables named the same as the old physical ones all his reports and queries will should keep working.
I'm an Access promoter, but not for use on websites because Jet/ACE is not threadsafe (though Michael Kaplan once said that is is threadsafe if you access it via ADO/OLEDB; I don't quite understand how a database abstraction layer can wash away a characteristic of the underlying database engine it's calling, but if MichKa said, it's 99% likely to be true).
Now, the exceptions would be if you're using it for prototyping something that will use a different database, or if it's read-only, or is read-write but will only ever have a very small number of users.
Michael Kaplan's website, trigeminal.com, used to use a Jet database as the back end (it may still -- I don't know that MichKa ever changed it), and when that was his main website he reported getting 100K hits a day. But it's a read-only site, so fits my restrictions.
There are so many different alternatives and they are mostly easy to use that I just don't see the point of trying to use Jet/ACE as back end for a website. I'd never do it myself (all the websites I'm responsible for use MySQL).
Simply put, go with MSSQL. Express edition is free, and will give you everything you need to migrate away from Access. These articles are talking about Access applications specifically, but the same issues will plague you.
http://resources.zdnet.co.uk/articles/features/0,1000002000,39285074,00.htm
https://web.archive.org/web/1/http://techrepublic%2ecom%2ecom/5208-6230-0.html?forumID=102&threadID=205509&messageID=2136367

Asp.net hosting provider with build capabilities and source control

Can you suggest an asp.net 3.5 hosting provider with continuous integration (cctray – nant builds) and source control facilities (svn)?
My requirement would be something like this:
I checkin to a svn branch (say trunk) on the hosting provider space.
CruiseControl.NET on the server fires off a build.
I see success/failure on my cctray.
On success my peers go to the website (say http://trunk.mywebsite.com) and see changes
I would also have to suggest a VPS as I have yet to see a Shared Hosting provider with compilers installed.
On the code repository side Assembla.com has free svn hosting and they also provide a way to kick off a build process by allowing you to specify a URL to post to when a check-in occurs. This URL can kick off a script that pulls the latest code and builds it. You can find more details on how to set this up here.
Shared hosting providers doesn't have that. You'll probably have to go with VPS, or maybe even Dedicated if services are consuming too much processor/ram.
I agree with everyone here. For every custom demands, it would be cheaper to look on a VPS / dedicated server to perform what you ask. You may find what you need, but at a high cost.

Resources