If you’ve started reading from this post, you’ll need to go through the previous parts of this series before going starting this one: Introduction Part 1: Setting Up a SQL Azure Server and Database Part 2: Scripting the On-Premise Database for SQL Azure Part 3: Executing the Scripts on the SQL Azure Database
With the database deployed, we can now focus our attention on the application itself. In this part, we’ll create the Cloud solution project in Visual Studio 2010 and migrate our on-premise application code to our new Cloud solution.
Creating a Cloud Solution
I know that I probably don't have to mention this, but all components of applications that you develop for production use should really have associated unit test projects.
Exploring the Generated Solution
Visual Studio has now gone ahead and provisioned everything we need in order to get started. Let’s have a look at the Solution Explorer.
As you can see there are two parts to Cloud projects – or two “projects” in the solution. The first project (with the blue icon) contains ServiceConfiguration.cscfg. ServiceConfiguration.cscfg, along with its definition file ServiceDefinition.csdef, specify the number of role instances to deploy for each role in the solution, the values of any configuration settings, and the thumbprints for any certificates associated with a role. The second project is the standard project that you would create for an on-premise solution.
For a deeper dive on the service configuration and service definition files, read through: Defining the Settings for an Application Configuring an Application
Migrating the Existing Project
Associating the Existing Project with a Cloud Role
With our existing Nerd Dinner project now imported, let’s have another look at the Solution Explorer.
Notice how the Cloud project is now showing that there are no projects associated with the Cloud roles. Let’s fix that.
Checking and Updating the Solution
We need to make sure that the System.Web.Mvc assembly will be copied to the local bin directory of the application.
The VMs within Windows Azure only support the files that ship with the .NET framework. Setting “Copy Local” to True in the properties of each additional assembly will ensure that it is included in the deployment package.
Expand the References node, select System.Web.Mvc, and open the Properties pane. Check the Copy Local attribute. It should be set to True.
Updating the Connection Strings
That’s it for the connecting strings. Now let’s test the application using the local development fabric before we deploy it to Windows Azure.