Ai Wei: [walk on the Cloud, Azure Services Platform] second time: first Cloud Hello,Cloud! -Alibaba Cloud Developer Community

1 Introduction

In the last article "the first time: knowing Azure Services Platform", I made a general introduction to Azure Service with the excitement of TechEd. Because I didn't apply for Invitation Token, I could only hide the impulse of hunger and thirst, leave the important task of completing the first cloud application to the second one. All the works about programming languages in history start with Hello, the world is the same, this article is no exception from Hello,Cloud! This tradition begins with implementing a Web application running on cloud services. Let's Taste the pleasure of walking on the cloud :-)

2 necessary preparations

to implement a simple cloud application, if there is no database service support or other service support, we still need to make some necessary preparations. For Azure applications, the following preparations are essential:

  • register a valid Azure Services account. For more information, visit here.
  • Apply for Invitation Token so that you can access related Services in the Azure Services Developer Portal, such as Windows Azure,Live Service, and. NET Services.
  • Install Azure Service SDK and other necessary support. You can use the familiar Visual Studio 2008 to develop Cloud Application. For detailed instructions, please refer to the description in the first chapter: Understanding Azure Services Platform.

Note: The Resource Token cannot be obtained simply because it is still in the CTP version. Please wait patiently :-)

well, everything is better than the east wind. Let's start building our Hello and Cloud Step By Step. In the following implementation process, we assume that you have completed all the preceding steps, successfully applied for Invitation Token, and successfully installed relevant SDKs and tools. If you have any questions, please refer to the detailed analysis of "the first time: Understanding Azure Services Platform", or leave a message for discussion :-)

3 implement my Hello,Cloud!

Step 1, use Visual Studio 2008 to create a new application, create a new Project, and select "Cloud Service"-> "Web Cloud Service" in the Project template ":

in this project template, we can also choose project templates such as "Web And Worker Cloud Service", "Worker Cloud Service" And "Cloud WorkFlow". We will gradually understand the corresponding content in the future series, please look forward to it.

Step 2: After the project is created, the Visual Studio automatically generates two projects: Anytao.AzureServices.HelloCloud and Anytao.AzureServices.HelloCloud_WebRole.

Anytao.AzureServices.HelloCloud_WebRole is an ordinary ASP .NET Web project, and another Anytao.AzureServices.HelloCloud is a Web Cloud Service project, which contains the Roles folder containing the Web project Assembly Anytao that we will publish. AzureServices.HelloCloud_WebRole.dll, and ServiceConfiguration. The cscfg file describes the deployment configuration information:

<?xml version="1.0"?>
<ServiceConfiguration serviceName="Anytao.AzureServices.HelloCloud" 
  <Role name="WebRole">
    <Instances count="1"/>

ServiceDefinition.csdef describes the mapping information of InputEndpoints,LocalStorage, and other configurations:

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="Anytao.AzureServices.HelloCloud"
  <WebRole name="WebRole">
      <!-- Must use port 80 for http and port 443 for https when running in the cloud -->
      <InputEndpoint name="HttpIn" protocol="http" port="80" />

we do not need to pay attention to the structure information of more files, and then use Hello,Cloud implementation.

Step 3: Complete the Web project Anytao.AzureServices.HelloCloud_WebRole , implement simple output Hello,World on the Default page!, This process is completely equivalent to that in traditional ASP .NET Web Application create an Html output, you can also add a Button and implement a simple event. Compilation and running will open the Azure simulator to host local applications instead of Web servers.

Step 4: Right-click the Cloud project and select Publis... ", Log on to the Azure Services Developer Portal to deploy the application. , open the local folder of the Publish generated by editing, which contains the Anytao.AzureServices.HelloCloud package and ServiceConfiguration configuration file for publishing Cloud applications in subsequent steps.

Step 5: log on to the open Azure Services Developer Portal and click New Project to create a New Azure Services Project. In the Service panel, select the Windows Azure option under Hosted Services:


in the following wizard steps

Step 6: import the package and configuration file. Select the Staging button in Deploying to open the deployment dialog box. Select Anytao. Publish. AzureServices package and HelloCloud configuration file in the local ServiceConfiguration file, respectively:


select the correct package and configuration file, enter the deployment information, and click Deploy. The package and configuration file will be uploaded to the cloud server that we admire, at this point, our first Cloud application will be successfully uploaded to the magical and vast Cloud. It is only one step away from us to realize the first Hello,Cloud! Applied.

After the deployment, you can select the configuration to re-import or modify the configuration information. You can select start or delete to perform other operations.

Step 7: convert the deployed application to Producation and select start, you have created and deployed Hello and Cloud. We can have a rest and then taste our first cloud masterpiece. Let's get started:

look, is it cool.

Step 8, be happy and prepare for the next article "go deep into Hello,Cloud details" , start the future journey. Tea :-)

4 summarizes

in addition, because Hello,Cloud will eventually be hosted in the Cloud, some traditional programming methods will change, for example, the path acquisition will be different from the traditional operation method on the Server path, so the Server.MapPath the acquisition method is bound to fail, we will gradually share the differences and features of Cloud applications in the future. This article is just the beginning.

Now, we can cheer loudly: Hello,Cloud! The era of cloud computing is coming. What are you waiting for? Try it quickly :-)


Selected, One-Stop Store for Enterprise Applications
Support various scenarios to meet companies' needs at different stages of development

Start Building Today with a Free Trial to 50+ Products

Learn and experience the power of Alibaba Cloud.

Sign Up Now