2. Creating Your First Windows Azure Application
To create your first Windows Azure application, perform these steps:
1. Open Visual Studio 2012.
2. Click File ⇒ New Project and select Visual Studio Solution.
3. Right-click the solution and select Add ⇒ New Project.
4. Select Cloud, and provide a name for your project: MyFirstAzureApp.
5. Add a location and click OK (see Figure 9).
6. In the New Windows Azure Cloud Service dialog, shown in Figure 10, select the ASP.NET MVC 4 Web Role project.
7. Click the
right-arrow button to add the Web role to the Azure solution. Click the
pencil icon to edit the name of the Web role (MyFirstAzureWebAPI).
8. Click OK.
9. In the New ASP.NET MVC Project dialog, select the Web API option.
10. Leave the default option, and click OK.
How it Works
Visual Studio creates the plumbing for
a new Web API project, which includes a Windows Azure (Cloud) project
and the Web API (MVC) project. Figure 11
highlights four parts of the solution for your benefit. The Cloud
project represents a “wrapper” project around the Web API MVC project.
The Cloud project contains configuration information and links
autodeployment and publishing features for developers to easily deploy
their code to Windows Azure. The three other parts are standard MVC
(that is, model, view, and controller) components. MVC components
process incoming requests, manage user input and interactions, and
execute application logic. The controller is typically separate and is
created to generate an HTML view of the request. The model is, for
example, a class that is used to model incoming or connected data. The
view is what is displayed to the user.
The next series of steps in the process of
creating an application with Windows Azure entails creating a simple
model to represent data. The following exercise walks you through this
process.