Microsoft Virtual Earth on Windows Azure
I reserved a part of my day to explore Windows Azure and how it can work with the Microsoft Virtual Earth Web Service. In my investigation I found out that what I was really interested in is The Azure Services Platform (to clarify any branding issues). In fact, “Windows® Azure is a cloud services operating system that serves as the development, service hosting and service management environment for the Azure Services Platform. Windows Azure provides developers with on-demand compute and storage to host, scale, and manage Web applications on the Internet through Microsoft® data centers. ” I’m game. Let’s build some Virtual Earth applications using the Azure Services Platforms.
Why should you care? Oh, I don’t know. This maybe the easiest way to deploy an application I’ve EVER found. Microsoft handles all of the IT (scalability, throughput, bandwidth, security). You can publish directly from Visual Studio. It’s super easy to integrate geocoding, maps and routing into your applications (shameless Virtual Earth plug).
Here’s a great example….I know a certain large retailer who has serious costs associated with developing and deploying ANYTHING to their .COM site. In fact a recent inquiry to change the proximity search radius on their store locator (dev, test, PM, deploy) was estimated at $25,000!!! It’s one line of code! Not only that, this IT group within the enterprise has become an Achilles heel for innovation stifling any type of technological advancement for the group – including replacing their store locator with Virtual Earth. Well, how about lining up resources with one of our partners to build the application for you and you pay Microsoft pennies to host and manage the application? You want to cut some costs? You want to be more agile in adopting new technologies? You want to scale out your development resources? Windows Azure is a good place to start.
Now, if you’ve read this blog you know I have a few samples using the Virtual Earth Web Services. Specifically, Geocoding with the Virtual Earth Web Service, Getting a Map with the Virtual Earth Web Service, and Routing in Virtual Earth Web Service. I figured these were perfect applications to prop up to the Azure Services Platform.
First things first. I had to register for the Community Technology Preview (CTP). I’m running Vista, so I needed Vista SP1 and .NET 3.5. Then I downloaded the Windows Azure SDK in order to begin developing with the cloud service. Then, I downloaded the Windows Azure Tools for Microsoft Visual Studio.
Next, I added a Web Role to the Roles folder. A web role is basically web project. There’s also a worker role which is basically backend computation that would happen behind the scenes.
I’ll add my 3 files (and code-behinds) from my other project (Geocoding.aspx, Map.aspx, and Route.aspx). I’ll add my service references for each Windows Communication Foundation (WCF) services for Virtual Earth’s Web Service – Geocoding, Imagery and Routing. Then, I added my web service for getting tokens. I updated all my references until I got a good build.
Then, I ran my project….and it choked. In order to run an application (even locally) “The Development Fabric must be run elevated.” I had to restart Visual Studio in an elevated administrator mode in order to run the application. Grrr.
I’m a PC, I’m a PC, I’m a PC…
Okay, and now…RUN!
Apparently, Azure made some storage in my local SQL Server Express install. Glad I had that.
“Windows Azure failed to initialize the development storage.” Grrr.
Run (again) and it’s runs successfully (timeout error)! So, I have my local copy of my Virtual Earth Web Service applications running perfectly – half way there. Now, to publish them to the cloud. To publish, I right click on the VECloudService Project and click Publish. A Windows Explorer windows opens to my application package and configuration settings files (very nice and clean); additionally, a web browser opens redirecting me to the Azure Service Developer Portal. I click New Project to get my project into the cloud. I want to publish my app to the cloud, but I have zero projects available for service hosting. Well, that’s because I haven’t used my invitation code to activate my token. So, I search my email and buried in my never-ending inbox is my invitation code. I go to the Account page on the Azure Services Developer Portal, enter my invitation code and bam! I have project credits. Woo-hoo!
Next, I give my project a name and description, “CP’s Virtual Earth Cloud Applications,” then specify my A-record for the domain, “CP,” so my new domain is https://cp.cloudapp.net – all Azure apps run on the CloudApp.net domain name. I click the Deploy button under staging. I’m prompted to upload two files. Remember that Windows Explorer window that opened with app package and config settings files? I grab the files. Then provide a Label – I use “1” because I don’t know what that means (Update: Once you upload your project, the “Label” is noted under Staging or Production. This allows you to track which build is where). I then click Deploy and wait…and wait…and wait…success! Next, I have 3 buttons to choose from under my application – Run, Configure or Delete. You have run your web site before the application will work, so I click Run. Now, I had to wait some time. I let an hour go by while I did something else (I can’t say what, but it has to do with what I’m presenting at MIX – more on that later). Not sure how long you actually need, but after an hour I realized I’d forgotten about it. I click the Staging link and it worked! I had posted my Virtual Earth Web Service application to the Azure Services Platform. Now, to promote it production so you can all see that I’m the real deal – a simple click of a button on the Azure Service Developer Portal and, done!
Promoting it to production was ridiculously fast! And that’s it. Now, I can share all my wonderful Virtual Earth applications with you. That was awesome. I’ve posted my apps to my Azure site and create a little list on default.aspx (the root of https://cp.cloudapp.net) so you can check them out or click the one you want below.
To be clear, Windows Azure is still a community technology preview but now is a great time to jump on board this train, because it is the core of Microsoft’s Services strategy and moving fast.