So, I was sitting around on the Friday before Labor Day, when suddenly, I thought: “I should make an app!”. And six days later, I had the app published:
But how did I build a cloud powered Windows 8 App in just six days? It was actually really easy, thanks to the new Windows Azure Mobile Services preview.
If you don’t know what Windows Azure Mobile Services are, I highly recommend you check it out. It enables you, the app developer, to develop a rich, cloud powered application without building any of your own infrastructure. If you need a SQL database to store data? Mobile Services takes care of that for you. Need to do push notifications? Azure can take care of that too.
Essentially, you build your data model all in your application. You simply mark your class with the new DataTable attribute, and mark the members with DataMember, and Azure Mobile Services handles the rest. What happens, is the new SDK takes your data and serializes it to JSON. It then makes various REST API calls to the Azure service you’ve set up, allowing it to store data in SQL Azure without having to write a data access layer. If you need to perform more powerful data validation or push notifications, you can use write scripts on the web service to perform these tasks with each call to GET, POST, DELTE, or UPDATE.
By using Azure Mobile Services, I spent part of Friday and Saturday writing authentication and data access code. From there, I was able to focus on my applications actual user interface and logic. I didn’t have to spend any time fiddling around with SQL databases, writing my own API methods, or rolling my own OAuth code. It was all taken care of by Azure Mobile Services and The core of the application was done by mid-Monday, and sent into certification later that evening.
You may be wondering, why did it take until Thursday to get the app into the store. The simple, scary answer? Certification. Windows Store certification is no easy task, especially for an app that was thrown together over one weekend. I failed it twice. This was of course due to bugs that hadn’t creeped up during my own testing, which takes me to one important point:
TEST FOR EVERY POSSIBLE USE CASE
I could have saved myself an entire day in certification time if I had realized that some people wouldn’t want to necessarily authenticate with Windows Live. Had I tested this, I would have seen that exiting a certain dialog crashed my app. Another important point to note when trying to certify an app that does ANYTHING with user data:
All in all, I have to say I was quite impressed with how flexible and easy to use Azure Mobile Services were when it came to writing an app like this. I highly encourage you to sign up for a Windows Azure 90 day trial, and try out the Azure Mobile Services preview. The best part? You’re not tied down to Windows 8. You could use Android, Windows Phone, or even iOS. Because it’s REST based, it’s a very flexible framework. If you need any resources to get started with Windows 8 app development, check out the new 30 to Launch program.
Also, I’d really appreciate it if you went ahead and give my app a try. It’s free and fun, and it’s the only one like it on the Windows Store. And, it’s powered by the cloud. Yay cloud!
In working with Windows Azure, I’ve noticed that the v1.3 of the Azure tools only support ASP.NET MVC2. This makes sense, given that that version of the tooling was released before ASP.NET MVC3 RTM’d. But what if we want to deploy an MVC3 application to Azure? I had to hunt around the internet for some info on this, so I figured I’d make a simple walkthrough for those who need the visuals. Well it’s easy, but takes a few steps.
First, open up Visual Studio and create a blank solution for the project:
Next, add an ASP.NET MVC3 application to the solution:
Next, we need to make sure that the ASP.NET MVC3 Assembly is set up for a bin deployment, as Azure does not yet support MVC3 out of the box. To do this, we set the “Copy Local” property of the System.Web.MVC.dll to true:
Now, it’s time to add our Windows Azure project to the solution. Add another project to the solution, this time choose a “Windows Azure Project”:
You’ll now be asked what kind of Web or Worker Roles you’d like to add to the Azure project. You can feel free to add any Role you choose, but for this sample we’ll just hit OK with no Roles added:
Now we’re ready to add our MVC3 Project to our Azure project as a Web Role. Right click on Roles in the Azure project, mouse over Add and select “Web Role in Solution”:
Select your MVC3 Application and hit OK. It should be in the list of projects:
Now hit debug on the solution and Viola! MVC3 in the cloud! It should be noted that in order to debug Windows Azure applications, Visual Studio needs to be run at an elevated level.
It’s simple enough to do, and I’m sure the team in charge of the Azure tools for Visual Studio will fix this with the next release. Until then, enjoy ASP.NET MVC3. You can grab ASP.NET MVC3, the Windows Azure tools, and all sorts of other goodies using the Microsoft Web Platform Installer.
Questions? Comments? Feel free to hit me up on Twitter, or leave a comment here on the blog.
Until next time,