Using Windows Azure Blob Storage in a local EPiServer site
Sometimes you might have the need of testing different versions of a site or for some other reason quickly put out a site. If you have a nice testing infrastructure with an expensive SAN or maybe complex DFS-replication for your VPP-directory this might be a bit of work, and maybe expensive to do. For us for example we can simply add another site in the IIS, but if we like to add another directory for the DFS replication we have to contact the infrastructure people. Because of this and because that EPiServer now support having your VPP-files (blob-storage) in Amazon or Windows Azure I decided to compare the performance of having the files in a local blob storage with having them in a Windows Azure blob storage. I did like this:
First I created two new EPiServer-projects in Visual Studio 2013 with the Alloy MVC template using the EPiServer extension from EPiServer and one Windows Azure Storage. After that I updated all EPiServer nuget package so to be up to date and for the one that are going to use Windows Azure blob storage I added two more packages, “EPiServer Azure 7.9.0” and “EPiCode.BlobConverter 18.104.22.168” (thanks BV Network AS for that one!). After that I run the both sites locally to be shore that EPiServer created the necessary blob files in the AppData folder (they are created on the first run of the site for the Alloy template) and after that I updated web.config for the Azure blob storage solution to use blob storage with the help of this article: http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-CMS/75/Deployment/Deployment-scenarios/Deploying-to-Azure-websites/. When that is done I run the Azure blob storage site locally again and logged in to admin and run the job “Convert file blobs” to upload the blobs to Windows Azure. After verifying that they were there I deleted the blob-directory from the AppData folder.
Now I was done with all the necessary changes and on local run on the developer machine it all locked good so now it was time to deploy it to two different virtual machines in Windows Azure so you can try it out also. To do a deploy to a virtual machine in Windows Azure is very simple with Visual studio 2013, all you have to do is right click on the website and choose publish Web and choose Windows Azure Virtual Machine. After doing that you can select an existing or create a new one from here.
Because these machines does not support local db out of the box I choose to deploy my two databases to SQL Azure. Doing this is also very easy if you got SQL Server Management Studio on your computer, all you have to do is to add the databasefiles from the project to your local server (or any other) and then rightclick on the database and below tasks select Deploy Database To SQL Azure.
A note is that with current version of the EPiServer database there are two things you have to do to get this to work, this is:
1. Add a clustered index to the table: CompletedScope
2. Change the stored procedure InsertCompletedScope so it says
“UPDATE [dbo].[CompletedScope] WITH(ROWLOCK, UPDLOCK)” instead of
“UPDATE [dbo].[CompletedScope] WITH(ROWLOCK UPDLOCK)”
After doing all that I changed so the web.config was pointing to the SQL Azure database and did a new deploy to the virtual machine. When that was done, I went into the Azure portal and connected to these virtual machines with RDP and did a manual copy of the blob-directory to the one with local files and added a demo license to both of these.
To try out them just go to these address and bare in mind that I used the smallest possible version of virtual machine so my MSDN account will not run out of credits on day one so the sites might be a little slow.
Alloy site on Azure virtual machine with local blobs and SQL Azure database:
Alloy site on Azure virtual machine with Windows Azure blobs and SQL Azure database:
I think that it works pretty good to have the blobs in Windows Azure even when the sites are in your own environment for development and tests. What do you think?