Views: 4681
Number of votes: 2
Average rating:

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 1.0.0.1” (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.

2014-07-01_2147

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:
http://epilocalblob.cloudapp.net/
Alloy site on Azure virtual machine with Windows Azure blobs and SQL Azure database:
http://epiblobazure.cloudapp.net/

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?

Jul 01, 2014

steve
(By steve, 7/2/2014 11:19:40 PM)

Cool!

For development (and production), it is just as easy to put the blobs in the SQL Database directly using the SqlBlobProvider (http://nuget.episerver.com/en/OtherPages/Package/?packageId=EPiCode.SqlBlobProvider).

The Blobs are actually stored in DDS, believe it or not :-)

Henrik Fransas
(By Henrik Fransas, 7/4/2014 10:48:41 AM)

Thanks.
Yes, saving them in the database is also a good solution, the problems is when it gets to mutch so the database goes away a lot in size, but also cool solution that helps a lot in a distributed system.

Henrik Fransas
(By Henrik Fransas, 8/29/2014 9:10:27 AM)

I have taken these sites down now because I needed to use my credits on MSDN to other tests and developments

Please login to comment.