Since I started off on my own, I wanted to make it a point to try new technologies in between projects.  This time I decided to make use of the lottery data I have for and create a lottery results site with ads.  My goal is for the site to be very simple (rare in the lottery space) and mobile friendly.  Spoiler alert — the site is up and running in acceptable form with instantly updated lottery results: .

I have been working with .NET for years and hence have always been in tune with Microsoft technologies as they surface.  The major exception to that rule is my understanding of the Azure ( platform so I decided to dive in headfirst by creating a simple site to host from the ground up with Azure in mind.

My Current Hosting Situation

For the past several years I have had a hosted VMWare ESX server, on which I host about 5 VMs running both Windows and Linux.  The price tag is a bit on the hefty side of things at almost $250 a month but it is a significant machine with 12GB of RAM, 8 CPUs, and 200GB storage.  If that machine were at full tilt all day long, there is no question that it would be a much better deal than what I would pay with a cloud provider like Azure.  That said, using something like Azure brings some much needed peace of mind ( e.g. System updates, backups, DB Maintenance, etc)

Getting Started


The first step was the easiest by far.  Microsoft is offering a 90 day free trial of their service which made trying it out a no brainer.  I signed up and was able to create new VMs, Worker Roles, DBs, etc in just a couple minutes.

For the site I decided to go the MS route the entire way, using all new (to me) technologies to boot.  Although I really wanted to spend some time trying out non MS things I really wanted to see what Azure could do using a pure MS stack.  My stack:  ASP.NET MVC 4, Razor, Entity Framework, and .NET 4.5.  Since I already had a database I wanted to work from on a SQL Server 2008 instance it was a no brainer to just use the Azure SQL server platform.  That no brainer was my first hiccup along the way.

Azure SQL Server

The database I decided to use  is the same my other project Lottopuddle ( ) is based on.  Right off the bat I found it contained several elements that were not Azure ready.  This accounted for a 4 hour aside, locating the offending tables which required simple modifications.  Once I found the correct tutorial, it really wasn’t that hard.  To migrate the database I ultimately ended up using this ( ) tool which made things so very easy.

Once the Azure SQL Server was up and running, with my production data I was happy to see that I could set the database to allow access from my cable modem’s public IP and connect to it using SQL Server Management Studio as well as my development environment.  This configuration is very ideal to track down bugs that have to do with unexpected data on a production database.

Now that my Database was up and running, I needed to migrate a Windows service I created awhile ago to update the lottery results from an API that I use.  Enter Worker Roles…

Creating a Worker Role

I won’t explain the details of what a  worker role is, that is the job of this site ( ).  What I will say is that I was able to, in less than 5 minutes, convert my windows service to this worker role and have it pushed up to the cloud.  This was due largely to the service pattern I used when initially implementing the process which meant I merely needed to import a few core libraries I had written and call it in the Azure Worker Role way.

I expected this to be painful but it was unbelievably simple.  Awesome!

Building the Site

Although I have dabbled with parts of the ASP.NET MVC framework I had never really built anything on it, more just salvaged peices when needing to do things RESTful.  I


followed a couple videos provided by MS online and was ready to start building.  My experience with Spring MVC proved very helpful as they are almost identical in many ways.

Altogether, the site took about 2 days to build.  At least 1 day of that was trying to figure out a UI design that worked for me and would have the ads I wanted.  I wanted it to be simple, very fast, and light as far a loading goes.  I was very happy when I did some benchmark tests using Apache Bench..

In short, every page load is doing a decent number of DB calls to my Azure SQL Server across Azure’s network.  I’m sure some level of caching is being done but I am thrilled at the performance of the tests.  500 requests served, 100 at a time, in less than 23 seconds.  With more mindful queries and intelligent caching I don’t think I would ever need more than one worker!

Publishing it All

This has to be my favorite part of this entire process.  Visual Studio 2012 Express makes it so unbelievably simple to publish worker roles and web roles to your cloud services.  It takes around 4 minutes for my package to push entirely into the cloud and be taking requests but it beats the hell out of the copy files, remote in, install, realize you had the wrong files, etc.



After seeing what Azure has to offer I have to admit I really like it.  I didn’t even touch their new Mobile Services which is entirely NodeJS based (definately my next trick).  The site I have built is very simple but I find a lot of comfort in knowing that I can throw more web worker roles at it in one click when its needed, like when MegaMillions is approaching the billion mark.  For what the site is doing, the hosting cost is not cheap (see below) but a lot of that is because I used their cloud services.  I could have deployed a website and cut the cost in half.