This hands-on article demonstrates how to build your first Cloud Application using Visual Studio.
Introduction
What is Cloud Computing?
- Can act as a Service - We can store and retrieve information, most basic service offered.
- Can act as a Platform/operating system - The future, through Cloud computing " Internet/Web " is a platform.
The "cloud" represents the Internet.
So Cloud computing is the use of the Internet/Web for the tasks you perform on your computer.
Getting Started
Prerequisites
Step 1:
Open Visual Studio, from menu File New Project. Select template Windows Azure Project, give appropriate solution name, select location path and then hit OK.
Step 2:
A new window will open asking for what kind of role/application you want to create. By default we will select and add a ASP.NET Web Role application and hit OK.
You can also change the default WebRole name to other meaningfull words. Click on the pen like icon provided.
The project is created; you can view the list of files created from project solution explorer.
Step 3:
Now drag and drop a Button and Label Control. Also, create an event handler for Button and run the project (F5 or hitting the green play button).
Step 4:
While running the project you will encounter an error as shown in the image below.
Step 5:
Why this error occurred?
Because in a real life scenario Cloud application will get deployed into dynamic highly scalable virtualized environment called Windows Azure (platform for Cloud Applications). In order to mimic this on our local host we need to run the Visual Studio in Administrator mode. Open the Visual Studio in Administrator (right click "Run as administrator") mode and select your project.
Step 6:
Now run your project; it will take some time to compile. You can see the background process going, on left bottom corner status bar.
When your page has loaded, click on the Button; you will get the text displayed on the Label. There we go; we have created our first Cloud Application.
During the first time when you run your project, a series of background setup initializations take place. Also a blue icon will appear on the right corner of the task bar. This is the virtual local Windows Azure created on your system.
Right click on the icon and click on "Show Compute Emulator UI". This will open the Emulator window, in which you can see the services created.
Step 7:
Right click on the icon and click on "Show Storage Emulator UI".
Step 8:
Assuming that the above services are not running, you will get an error as below. Click "OK", the services will automatically start.
How to publish the application
Right click on your project and click "Publish". A new window with two options will appear
Create Service Package Only
This will publish two files into project publish folder, which later you can manually upload to a Windows Azure platform over internet (Internet connection is must).
Deploy directly to Windows Azure
You need to Sign Up and subscribe to both the facilities above.
http://www.microsoft.com/windowsazure/offers/
We already have a couple of articles "How to Publish Cloud Applications".
http://www.c-sharpcorner.com/UploadFile/suthish_nair/4802/Default.aspx
http://www.c-sharpcorner.com/UploadFile/suthish_nair/4827/Default.aspx
Summary
Hope you all enjoyed this article. I tried my best to show all the step by step way to create the project. Please comment!