A first look at programming Cloud-based applications using Visual Studio 2010



Introduction: This article aims to provide a brief introduction to cloud programming using Visual Studio 2010.

Definitions 


Cloud: Per Wikipedia "Cloud computing is Internet-based computing, whereby shared resources, software and information are provided to computers"

Windows Azure: Microsoft Cloud Computing Platform.

Role: Element or individually scalable component running in the cloud.Each instance corresponds to a Virtual Machine in the cloud.

Web Role
: Web application running on IIS. Is accessible via http or https endpoint.

Worker Role: Background processing application. Can expose internet facing and internal endpoints.

Scalability in the cloud: To handle additional load, number of instances can be increased.

Storage Services: scalable storage solutions to provide support to sustain scaling in load. Blob, queue and table storage services in Microsoft Azure storage. 

Microsoft SQL Azure: Cloud based relational db service built on SQL Server technology. 

Development Fabric: local Simulation Environment: enables local development and testing of Cloud applications.

Details

Visual Studio 2010 provides support for programming cloud based services. 

There are 3 areas where Microsoft provides developers with a hook into cloud-based programming:
  1. Development and configuration tool
  2. Local testing environment 
  3. Deployment 
Install Windows Azure tools for Visual Studio to get started with cloud programming.

To create a new Role, you can create a new Project and use one of the templates such as such as ASP.Net Web Role template, WCF Service Role template, ASP.Net MVC role template.

Web Roles contain additional references to assemblies compared to standard ASP.Net web app such as Microsoft.Windows.Azure.Diagnostics, Microsoft.Windows.Azure.ServiceRuntime, Microsoft.Windows.Azure.StorageClient.

The cloud service project is a deployment project that defines which roles are included, their definition and configuration files.
 
A simulation environment is provided locally through IIS to develop and test cloud-based services. Development Fabric provides a local test environment enabling developers to develop and test cloud based applications on local machines.

Process
  1. First Develop and build the application locally using Windows Azure Development Fabric and using local storage.
  2. Once the application is tested locally, run in mixed mode - run the application locally using a Windows Azure Storage Account.
  3. After everything is validated in mixed mode, deploy and test your application on Windows Azure using a Windows Azure storage account and id.
  4. Each Windows Azure Hosted Service has a private staging deployment area and a public Production deployment area. Windows Azure account id can be provisioned online on windows.azure.com.The provisioning process provides options to set a friendly account name, select affinity groups etc. Affinity groups indicate tight coupling for storage and hosted services, where possible. When you deploy the application to Staging on Windows Azure, the Role is in Allocated state. Once you click Run, the Role is in Initializing state. When the Role is ready, it moves to the Started State.For testing your application in the staging environment, you can navigate to the staging URL which is a URL starting with a guid. 
  5. Once everything is tested, the Role can be promoted to Production area. From this stage, the Role is available to end users. 
  6. For on-going changes/fixes, you can modify the development environment. In order to maintain separate storage for staging and production, separate storage bindings for the deployment and staging. When you expect the load to increase, the instance count can be increased by modifying and re-deploying the service configuration file. 
References: MSDN

Conclusion


In this article, we took an introductory look at the world of building cloud-based applications. I hope this article provides you enough information to generate an interest in further pursuing this choice of solutions.

Happy Coding!

Disclaimer: This article is purely for demonstration. This article should not be construed as a best practices white paper. This article is entirely original, unless specified. Any resemblance to other material is an un-intentional coincidence and should not be misconstrued as malicious, slanderous, or any anything else hereof.