. NET website you must know|Anytao technology blog
[Walk through the Cloud, Azure Services Platform] 2: My first Cloud application: Hello, Cloud!
Released on: 2008.11.19 by: Anytao
2008 Original Works of Anytao.com and Anytao. Please refer to the author and source in the post.
| Before |
Haha, my first Cloud application was born. This is Hello, Cloud. If you don't believe it, visit http://anytao.cloudapp.net/to get a glimpse.
Now, we can cheer up: Hello, Cloud! The cloud computing era has come. What are you waiting for? Please try it now :-) |
1 Introduction
In the first article: Understanding Azure Services Platform, I gave an overview of Azure Service with the excitement of TechEd, because I did not apply for Invitation Token, therefore, we can only conceal the hunger and thirst impulse and leave the task of completing the first cloud application to the second time. It's just like starting with Hello and world, all the books about programming languages in history. This article is no exception from Hello, Cloud! This tradition begins to implement a Web application running on cloud services. Let's have a taste of the pleasure of walking on the cloud :-)
2. necessary preparation
To implement a simple cloud application without database service support or other service support, we still need 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 to access Services in the Azure Services Developer Portal, such as Windows Azure, Live Service, and. NET Services.
- Install the Azure Service SDK and other necessary support. Once again, you can use the familiar Visual Studio 2008 to develop Cloud applications. For more information, see Chapter 1: Understanding Azure Services Platform.
Note: The Resource Token cannot be obtained simply because it is still in the CTP version. Please wait for a while :-)
Well, everything has nothing to do. We started to build our Hello, Cloud Step By Step. In the following implementation process, we assume that you have completed the preparation of all the above steps, successfully applied for Invitation Token, and successfully installed the relevant SDK and tool support. If you have any questions, refer to the detailed analysis on "First: Understanding Azure Services Platform", or leave a message to discuss the issue :-)
3. Implement my Hello, Cloud!
- Step 1: Use Visual Studio 2008 to create a new application. Create a Project and select "Cloud Service"> "Web Cloud Service" in the Project template ":
In this project template, we can also select project templates such as "Web And Worker Cloud Service", "Worker Cloud Service", And "Cloud WorkFlow, we will learn more about the relevant content in future series.
- Step 2: after creating a project, Visual Studio automatically generates two projects: Anytao. AzureServices. HelloCloud and Anytao. AzureServices. HelloCloud_WebRole,
Anytao. azureServices. helloCloud_WebRole is a common ASP. NET Web project, and another Anytao. azureServices. helloCloud is a Web Cloud Service project, which contains the Roles folder and the Web project assembly Anytao. azureServices. helloCloud_WebRole.dll, while ServiceConfiguration. the cscfg file describes the deployment configurations:
<?xml version="1.0"?>
<ServiceConfiguration serviceName="Anytao.AzureServices.HelloCloud" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
<Role name="WebRole">
<Instances count="1"/>
<ConfigurationSettings>
</ConfigurationSettings>
</Role>
</ServiceConfiguration>
ServiceDefinition. csdef describes configuration ing information such as InputEndpoints and LocalStorage:
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="Anytao.AzureServices.HelloCloud" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="WebRole">
<InputEndpoints>
<!-- Must use port 80 for http and port 443 for https when running in the cloud -->
<InputEndpoint name="HttpIn" protocol="http" port="80" />
</InputEndpoints>
</WebRole>
</ServiceDefinition>
We don't need to pay attention to the structure information of more files. Next we will implement the Hello and Cloud functions.
- Step 3: complete the Web Project Anytao. AzureServices. HelloCloud_WebRole and implement simple output Hello, World! On the Default page !, This process is equivalent to the traditional ASP. NET Web Application creates an Html output. Of course, you can add a Button and implement a simple event. Compiling and running will open the Azure simulator to host local applications, rather than the Web server.
- Step 4: Right-click the Cloud Project and choose "Publis ...", Log on to the Azure Services Developer Portal to prepare to deploy the application, and open the local Publish folder generated by editing, which contains Anytao. azureServices. the HelloCloud package and ServiceConfiguration file are used to publish Cloud applications in subsequent steps.
- Step 5: log on to the Azure Services Developer Portal and click "New Project" to create a New Azure Services Project, on the Service component panel, select the "Hosted Services" option under "Windows Azure:
In the subsequent creation wizard steps
- Agree to Team of Use terms
- Enter Project Properties (that is, create a project signature and description)
- Enter the Hosted Services Name and ensure that the selected name is unique. This Name will also be used to publish the access domain Name for your Cloud application. For example, if you enter anytao as the Name, it will be applied through http://anytao.cloudapp.net/#my hello,cloud.
- Step 6: import the package and configuration file. Select the "Deploying" button of "Staging" to open the deployment dialog box. Select the Anytao. AzureServices. HelloCloud package and ServiceConfiguration configuration files in the local Publish 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 we admire, so far, our first Cloud application will be successfully uploaded to the magical and vast Cloud. We can achieve the first Hello, Cloud! Application.
After deployment, you can choose to re-import or modify the configuration information. You can choose to start or delete the configuration and perform other operations.
- Step 7: Convert the deployed application to Producation and select start. Now the entire Hello, Cloud creation and deployment are complete. We can rest and taste our first cloud masterpiece. Start:
Http://anytao.cloudapp.net/
You see, Isn't it cool.
- Step 8. Be happy and prepare the next article "go deep into Hello, Cloud details" to start your journey in the future. Upper tea :-)
4. Summary
In addition, because Hello, Cloud will eventually host in Cloud, some programming methods in the traditional sense will change, for example, the path acquisition method is different from the Operation Method in the traditional sense on the Server path, so the Server. the MapPath acquisition method will inevitably fail, so we will gradually share the differences and features in Cloud applications in the future of the series. This article is just the beginning.
Now, we can cheer up: Hello, Cloud! The cloud computing era has come. What are you waiting for? Please try it now :-)
References
- Http://www.azure.com/
- Http://channel9.msdn.com/posts/smarx/Windows-Azure-Hello-Cloud/
Anytao | 2008 Anytao.com
| Honors: http://anytao.cnblogs.com/
This document is provided as "the status quo" without any guarantee and does not grant any rights. | This posting is provided "as is" with no warranties, and confers no rights.
The copyright of this article is owned by the author. You are welcome to repost this article, but you must keep this statement without the author's consent and provide a clear link to the original article on the article page. Otherwise, you will be entitled to pursue legal liability.