The World’s Leading Microsoft .NET Magazine
   
 
The .NET Addict's Blog

My Top Tags

                                                           

My RSS Feeds








I heart FeedBurner

Latest Diggs - Programming

Computers Blogs - Blog Top Sites

Site Hits

Total: 4,863,575
since: 19 Jan 2005

Setting up an ASP.NET MVC 2 Application for Windows Azure

posted Sat 14 Nov 09

Yesterday, Microsoft released another update to the Windows Azure SDK. This update includes a truckload of new goodies that I will be covering in additional blog posts. For this blog post, however, I want to walk you through getting an ASP.NET MVC 2 application working on Windows Azure in Visual Studio 2010 Beta 2. Now that Azure and VS2010 are finally starting to sync up, the amount of raw goodness coming out of Redmond cannot be measured.

First, install the Windows Azure SDK and the Windows Azure Tools for Visual Studio, making sure you pay attention to all of the installation details. There are lots of little hotfixes and things that you might need. Luckily, if you're running VS2010 Beta 2 on Windows 7, you have very little extra work to do beyond configuring IIS 7 for WCF HTTP activation.

Once you've got that installed, create a new project. The project template you're looking for is in the group Cloud Service and is called Cloud Service. Once you give this new solution a name and click next, you'll be given a dialog box that looks like the one in the screenshot below:

screenshot

The fantastic thing here is that you'll see, without us having to do any hackery or modify any .csproj files with notepad, there is a web role available for an ASP.NET MVC 2 application. Click the right-arrow button to add that to your cloud service and then pick a worker role if you want one.

After you get that started, if you are running SQL Express, you should be able to hit F5 and see a nice hello world application. The local development storage simulator requires either SQL Express or a full version of SQL 2005+. If you're not running SQL Express and you're running a full version of SQL 2008 like a real developer (kidding!) then you'll need to open up a command prompt. Go to the c:\program files\windows azure SDK\v1.0\bin\devstore directory (this is the same for both 64 and 32-bit systems). Then run the following command:

dsinit /sqlinstance:. /forceCreate

If you're not using the default SQL instance, then replace the "." with the name of your instance. If your windows account doesn't have sufficient permissions to do this, then you'll need to either rectify that using SQL Server Management Studio or use an optional command-line parameter to specify the SQL server credentials required to create the development storage schemas. After executing this command, you'll see a dialog box like the one below:

screenshot

Now you should be good to go. If you hit F5 in Visual Studio 2010, you'll see some scrolling messages in the status bar about "waiting for roles to startup" and it'll take a few minutes initially, but eventually you'll see the default home page from your MVC 2 project. If you think you're done, think again.

Just as with getting the MVC 1 project to work on Windows Azure, you cannot use the default providers. These providers work against a local SQL Express database by default and they don't work against cloud storage. You're going to need to fix this before you deploy your application to the cloud. For that, you're going to have to wait for my next blog post ;) Get your hello world working locally and then you'll be ready to tweak it as you follow along with my next post.

tags:          

links: digg this    del.icio.us    technorati    reddit

AddThis Social Bookmark Button




1. Kevin Hoffman left...
Sat 14 Nov 09 5:16 pm

I am currently trying to figure out how to get the ASP providers to work against the new storageclient library. If you're using Visual Studio 2008, then you just need to install the "additional samples" from the Azure download area (just google) it. If you're using Visual Studio 2010, we appear to be screwed. I will blog the solution once I get one.


Tag Related Posts

Html.JqGrid - Cleaning up your jqGrid Code

Tue 22 Dec 09 8:46 P GMT-05
tags:              

Get Your Red Hot VS2010 Beta 2!

Mon 19 Oct 09 8:43 P GMT-05
tags:      

How to Build your First Azure-Powered MVC App

Tue 29 Sep 09 2:16 P GMT-05
tags:        

Configuration Settings in Azure Applications

Mon 28 Sep 09 2:59 P GMT-05
tags:        

Fix for Minor Bug in ASP.NET MVC New Project Template

Mon 04 May 09 2:48 A GMT-05
tags:      

SSDS loses an "S" and gains some awesome

Wed 11 Mar 09 11:42 A GMT-05
tags:              

Live Mesh Tutorial 1 - Hello Live Mesh

Thu 06 Nov 08 2:33 P GMT-05

Microsoft Windows Azure Distilled

Tue 28 Oct 08 1:42 P GMT-05

The Evolution of the Cloud - Then and Now

Mon 06 Oct 08 12:34 P GMT-05

Microsoft's Lofty Direction

Sun 05 Oct 08 2:30 P GMT-05

MobileMe vs. Live Mesh Throwdown - Round 1

Wed 16 Jul 08 10:33 A GMT-05

Scott Guthrie Updates the ASP.NET MVC Roadmap

Wed 13 Feb 08 3:49 P GMT-05
tags:    

ASP.NET 3.5 Extensions Preview Released

Mon 10 Dec 07 2:10 P GMT-05

Microsoft unveils an MVC framework for ASP.NET

Mon 08 Oct 07 12:58 P GMT-05
tags:      

Exploring the MVC Pattern in WPF

Tue 10 Apr 07 12:51 P GMT-05
tags: