The first cloud program in combat

Source: Internet
Author: User
Keywords nbsp we cloud computing nbsp;
Tags .net access address advantages and disadvantages application application development application software applications
Copyright Notice: Original works, allow reprint, reprint, please be sure to hyperlink form to indicate the original source of the article, author information and this statement. Otherwise, legal liability will be held. http://knightswarrior.blog.51cto.com/1792698/388907. First of all, the Templars are delighted to receive the attention and support of the cloud Computing series, which has been in preparation for several months, and finally released the first one today (because the article is too long, it is two pieces, and this is an article). In these months through continuous use and practice, cloud computing has finally a more superficial understanding, so also hope to share with you. Before the release of this article also considered for a long time, because the beginning of the concept, will not be very good results, after all, we are not too familiar with this new thing.  Rather than "parrot" a simple example, so I first choose a practical application to see what the cloud can bring us, from the developer point of view, with the introduction of the concept of what it needs to change is our most concerned about the problem. This article is arranged as follows: First, review the previous basic knowledge, so that everyone can have a general understanding; then introduce the development tools, the so-called "工欲善其事, prerequisite," and then the development of the first simple program, through this simple program to look at its development process , after development, you need to deploy, we have to have an account to do this before we talk about deployment, so we'll explain the account application and deployment process in turn; everyone has been using the program + database model to develop our applications, so next we talk about SQL Azure and classic program + database mode, So that everyone can avoid unfamiliar feelings, so that understanding also become easier. Through this article, we have a clearer understanding of cloud computing, understanding what it is, what it can do, and how to do it. If you know these problems, it has reached the desired effect, but also for the article behind the series laid a cornerstone, so I hope to help you. Two. Outline of this article · 1. Summary · 2. Outline of this article · 3. Cloud Computing Basics Review · 4. Development Tools · 5. First simple procedure · 6. Account Application · 7. Deployment · 8.SQL Azure 9. Classic program + database mode · 10. This article summarizes · 11. Series Progress Three. Basic review of cloud computing in the previous articles, we talked a lot of concepts, so here is a brief review (see more details on the previous articles): First, the trend of industry development throughout the software industry development process and trends can be seen in the following stages: machine-oriented language (Monolithic) Development model: According to the machine language of different platforms to customize the development of code, so developed code versatility and reusability is relatively poor, but this is also the hardwareand software environment. Process-oriented (Procedure) development model: machine-independent programming languages (such as C, Pascal, etc.) make the development process easier, using processes to describe our requirements, and to encapsulate our code with functions. The process-oriented development model is a encapsulation of reusable code, which is a step closer to the previous machine-oriented development model: object-oriented development patterns that describe and draw a relatively complete object with more realistic objects. Object-oriented languages (c + +, C #, Java, etc.) provide more abstract encapsulation and reuse patterns. Object-oriented development emphasizes the direct mapping of real world problems into our program, so it is closer to the natural way of thinking of human beings. The object-oriented development pattern is a encapsulation of reusable objects, so it is a step ahead of the previous process-oriented development model; component oriented (Component) development pattern: object-oriented in many ways to improve the development model, but with the gradual expansion of the software development scale, in the distribution, In complex environments such as asynchronous architectures, code-level reusability is poor, maintainability is poor, and inefficient weaknesses become particularly prominent, so people use the architecture to run the environment (such as. NET,J2EE, etc.) to provide a sound platform for support, so that the developer freed up, more focused on the development of the core business. These business functions are run in a schema-run environment in the form of components such as DCOM, EJB, and so on. The reuse pattern of software development also rises to the level of business components. Component-oriented development patterns in asynchronous architectures, distributed systems, such as the application of particularly prominent, this model for the object-oriented development model has been well supplemented; service-oriented (SOA) development model: When the scope of software use extends to a broader scope, often face more complex IT environment and more flexible requirements. The concept of services (service) has emerged and people are publishing applications (creator) in the form of business Services (Business Service) for others, without having to think about which architectural system these business services are running on, Because all the services speak the same language. SOA takes into account the long-term nature of business development and embodies the idea that change is eternal. The core of SOA is "reuse" and "interoperability" in enterprise applications or business functions, instead of opposing it to the business, which can be seen as an important step in the direction of it-driven business. The service-oriented development model is designed to support more flexible heterogeneous, distributed systems; cloud-oriented (Cloud) Development mode: In fact, the use of several of the previous development models can solve the current applications, but people always consider the reorganization of resources has reached the best use of resources. This is when cloud computing is born. Cloud computing (Cloud Computing) is grid computing, distributed computing, parallel computing, networked storage, virtualization, load balancing and other traditional computer technologies and network technology development and integration of products. A network that provides resources is called a "cloud." The resources in the cloud can be extended indefinitely by the user, and can be obtained at any time, on demand, at any time, and paid for by use. Simply put, cloud computing simplifies our infrastructure and provides the enterprise with greater scalability and flexibility. In the original mode if you build a small application, you need to rent the server, you need to consider the security and stability of the rental server and so on. If you build a medium and large application, we need to spend a lot of money to buy the hardware to cluster, and then the huge sums to buy the required system software and these need some people to maintain. Now the cloud can provide the hardware and software equipment we need for the program, all you have to do is lease these existing resources, upload your programs, and modify the configuration files, so you can flexibly expand or shrink your resources, so that you can achieve the goal of reasonable utilization of resources, while also reducing the cost of maintaining these hardware and software. The above stages can also be summed up as a simple three trends, which is now the three characteristics of cloud computing: Software as a service (Saas--software as a service) a software allocation model that enables applications to be hosted by suppliers or service providers, and provided to users through the network. Platform is a service (Paas--platform as a service) a platform allocation pattern that provides operating systems and related services over the network so that customers do not have to download or install them. Infrastructure as a service (iaas--infrastructure as a services) an infrastructure allocation model that delivers these infrastructures in the form of outsourcing, including storage, hardware devices, servers, and network components. Second, cloud computing advantages and disadvantages of any one thing has advantages and disadvantages, cloud computing is not exceptional, so we can not generalize to it, only fully aware of these advantages and disadvantages can be better to make decisions. Maybe you can call it a revolution that's a lot bigger than Web 2.0; maybe you can also call it a concept hype and a new bottle of old wine, no matter how, without den gained, then let's make a concrete analysis of its advantages and disadvantages. Advantages or benefits to apply: 1. Can quickly build our application cloud computing's biggest advantage is the ability to quickly build our enterprise applications, such as we are now to develop a Web site, we do not have to worry about the need to spend huge sums of money to buy hardware to cluster, Then there is a huge amount of money to buy the required system software and these also need some people to build and maintain, if this happens to be a relatively new and potentially profitable business ideas, it is a good choice to build on the cloud, which at least one step ahead of other companies. 2. Provides greater flexibility and scalability   As the "cloud" scale can be dynamically scalable, so you can not increase the investment of hardware equipment to meet the needs of application and user scale growth, but also invisible to the role of reducing costs. If the project suddenly scrapped, there is no big loss, so in this respect, cloud computing is quite flexible and easy to expand. 3. Can solve a number of special scenarios many companies are in a specific period of large profits, for example, some Valentine's and Christmas's deputy companies, they are in this time the turnover is larger, at other times of the year, almost not profitable, in this case, if according to traditional software deployment habits, is bound to cause a certain amount of waste. Just as an enterprise with a lot of peaks and troughs, you may be forced to allocate more IT resources to peak periods. In this case, outsourcing peak demand may save more cost. 4. Shorten the product development cycle regardless of which vendor you are using the cloud products. There is a significant feature that can shorten the product development cycle, an idea to a product development cycle due to the advent of cloud computing gradually shortened, so you can see the huge value inside. Cloud computing has really begun to affect the way we do business. We began to reduce the cycle of research, which is very important and necessary for us. 5. Save the cost of building infrastructure in fact, for each enterprise infrastructure is a relatively large expense, and in addition to the cost of the need for specialized human and material input, in this process and to maintain a rapid pace of software and hardware updates to adapt to the changing market, So the advent of cloud computing is undoubtedly a solution worth considering. Many times, we also often notice that the data center is not usable enough, the application software beyond the infrastructure capacity, software and hardware updates too fast, and so on, cloud services can help enterprises to transfer capital to operating costs, especially at a critical juncture of vital importance, so in this regard, it is worth considering. Disadvantages or areas needing improvement: 1. Data security in terms of data security, the hot cloud computing vendors such as Amazon, Google, IBM, Microsoft, Oracle, Cisco, HP, Salesforce, VMware, etc., have not completely solved the problem, So many companies know the type and classification of the data they use, and they decide to control the data through internal controls. Instead of placing applications with competitive advantage or containing user-sensitive information on the public cloud, this is one reason why many companies stay on the sidelines. 2. The company will sometimes exceed the budget according to the flow rate although the cloud manufacturers to launch a cloud products at any time to promote access, on demand, at any time to expand, according to the use of pay, but to a large extent, the price is relatively high, at least for the time being there is no downward trend, so that some enterprises will have the opposite effect, For example, companies like Sony Entertainment do not consider using external cloud services to address the challenges of storage scalability. Located in CaliforniaNick Bali, a senior system engineer at Culver City in Asia, said. Sony animated every day to access and produce the amount of data between 4,000 trillion to 12,000 trillion. Bali explained that "if you put data on the cloud, we need a very large network bandwidth, which costs too much, even more than the cost of buying the storage itself." Sony is currently using Parascale cloud storage software to evaluate private storage clouds. So from this point of view is not the cloud platform is necessarily cheap. 3. Corporate ownership reduction in fact, the issue of enterprise autonomy is a relatively controversial topic, perhaps this is also due to careful consideration, after all, the application of their own company, we all want to be fully managed and controlled, the original model, you can build their own infrastructure, each layer of application can be customized settings and management , and after the cloud platform, the enterprise does not need to worry about infrastructure, and do not need to worry about such as security, fault tolerance and so on, the benefits are one aspect, but also let the enterprise feel worried, after all, now familiar things suddenly become a black box. Of course at this time the manufacturers also launched an internal cloud or cloud suite to remedy, but the problem has not been fundamentally resolved. 4. Large and shaped enterprises are difficult to expand many large enterprises have spent a lot of money to buy hardware and gradually build their own server cluster (some enterprises also have a large number of purchase of the latest blade server), then also purchased the required system software and application software, but also built on this basis platform architecture. So for such enterprises, they do not need to put their own application to the end of the cloud, so this is also a lot of companies do not want to transplant one of the reasons. 5. Cloud computing itself is not too mature. Although the cloud computing companies to the cloud, each company launched Cloud products and cloud suites are dazzling, endless, but they are each other, there is no unified platform and standards to standardize. So calm down and think about it, in the end it can be used for our enterprises, in terms of security, stability and enterprise itself factors must be considered in spite of the prudent, do not be in front of the ads fooled. You should know that every enterprise should promote its own products will take various means, for example, when the public cloud is unsafe, the vendors start pushing the private cloud, and when the company's original application is difficult to integrate into the cloud, the manufacturer immediately launches the hybrid cloud; Of course we are willing to be the touchstone in this process, because after experiencing it, we believe that it will certainly become the future trend. Third, the current situation to understand the basic concept of cloud computing, the next thing to do is how to select the appropriate cloud provider, after all, we are not Amazon, Google, Microsoft, Alibaba, wave and other focused on cloud computing enterprises, so if we use cloud computing, We must choose a suitable cloud manufacturer to serve us.                                            Figure 1 above contains a number of early cloud computing manufacturers, in fact, in general, cloud computing companies are dotted, not only foreign Amazon, Google, IBM, Microsoft, Oracle, Cisco, Hewlett-Packard, Salesforce, VMware and other large enterprises, but also including the domestic Alibaba , the movement, the tide and so on also joined this arena. Four, Microsoft's cloud platform Although we cannot develop a cloud platform, but we can use and experience the benefits of the cloud platform, in the process, we can through the specific use, in-depth analysis, reuse, regression summary of the way to gradually deepen our awareness, That way, you get the expected benefit from the cycle. Our series is currently focused on Microsoft's cloud platform, Windows Azure Platform, which is Microsoft's complete cloud computing platform, which currently contains three major parts (see Cloud Computing Tour 4-windows Azure Overview):                                            Map 2 


Windows Azure: The operating system running in the cloud is virtual and transparent to the user, providing compute (computing), Storage (storage), and manage (management) of the three main functions and their underlying services, which are quite handy to use.


SQL Azure: A relational database running in the cloud, similar to SQL Server 2008, but not as powerful in functionality.


AppFabric: The full name is Windows Azure platform AppFabric, which provides access control, service bus, and so on, primarily to connect the underlying application to the cloud. Four. Development tools as the saying goes, "工欲善其事, prerequisite." Before we develop any program, we need to understand the tools to develop it, the use of development tools can always play a multiplier effect, this is no doubt, after all, the command line, assembly, Notepad is the way to require a lot of time and energy, and debugging and exception tracking is also extremely difficult. Microsoft's Windows Azure development tool is simple, we install the VS2008 or VS2010, SQL Server 2005/2008/2008 R2, then install an extended toolkit can be used for cloud application development, This extension kit is: Windows Azure Tools for Microsoft Visual Studio 1.2 (which contains Windows Azure SDK and Visual Studio Integration) with the download address:


http://www.microsoft.com/downloads/details.aspx? Familyid=2274a0a8-5d37-4eac-b50a-e197dc340f6f&displaylang=en This version was released in June 2010, including the Windows Azure Tools + SDK, So when you install it, you don't need to install additional software, which includes: New feature support: Full support for Visual Studio RTM so we can use the latest templates and powerful new features.


support:. NET 4 support enables developers to build services with the flexibility of selecting. NET 2.0,. NET 3.0,. NET 3.5, or. NET 4 frameworks.


Application visualization: By displaying a read-only view of Windows Azure table and Blob containers in Visual Studio Server Explorer, we can preview the application we created in a view. Cloud Storage Explorer also makes it easier for developers to build better services.


Consolidated deployment: Developers can deploy services directly by selecting "Publish" in Visual Studio Solution Explorer, which is also available in version 1.1.


Service monitoring: Helps developers track and manage their service status through the ' Compute ' node in Server Explorer.


Easy to debug: IntelliTrace supports services running in the cloud, simplifying debugging for cloud services. In fact, the process of developing a cloud program using VS 2008 and VS2010 is not fundamentally different, with VS 2010 providing a set of tools for developing, debugging, deploying, and managing cloud applications, such as developing cloud computing program patterns, developing cloud computing project templates, off-line testing cloud computing projects, Cloud computing deployment and so on, these features have shortened the cloud application development cycle, to a large extent improve the development efficiency, so we will use the VS Get development cloud applications, of course, in order to take care of some of the use of VS 2008 friends, we will try to provide two versions. Five. The first simple procedure step one: Create the Cloud project   is the so-called "one by one". After installing the development tools, we'll create the first application, and since I have the Windows 7 operating system installed, open Visual Studio 2008 with administrator privileges, and if you have an operating system like XP, run Visual Studio 2008 directly, Because we've already installed Windows Azure Tools for Microsoft Visual Studio 1.2, you'll see a cloud option in the following diagram template (Figure 1), click the Cloud option, and select Windows Azure Cloud Service template (Figure 2), named Item Firstcloudapp, click OK button to create our project:                                           Figure 3 After the pop-up window appears, follow the image below, Click the ">" button on tab 1 for asp.net Web role and label 2, respectively. This step creates a new Webrole item in the right window, where you can click on the pen icon of the tag 4 and change the Web role name, and you can also click on the tab 5 to remove the newly created item, and then click the OK button when you're done.                                          Figure 4 Step two: Observe the generated cloud project   Project structure as shown in the following illustration:                                           Figure 5 by the project structure chart we can see the difference between cloud project and ordinary asp.net project, asp.net Web The role Cloud project generates a project for cloud applications and a ASP.net project, the Cloud Application project refers to the ASP.net project, while the Cloud Application project also contains service program files and service profiles, which will be used when configuring, running, and deploying cloud applications, without these two files, There is no cloud program. You can also use these profiles to customize our application, in the next course, we will also detail the internal principles of the program file and considerations. Edit Default.aspx page, add some simple test information, code such as: <%@ page language= "C #" autoeventwireup= "true" codebehind= "Default.aspx.cs" inherits= "Webrole1._default"%>





<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">


<html xmlns= "http://www.w3.org/1999/xhtml" >


<head runat= "Server" >


<title></title>


</head>


<body>


<form id= "Form1" runat= "Server" >


<div>


<div>


<img alt= "src=" 2010-8-22%2011-55-50.png "style=" WIDTH:314PX; height:155px "/><br/>


</div>


<div style= "Font-size:x-large; Color: #FF0000 >

The Knights of the
are already in the clouds!!! </div>


</div>


</form>


</body>


</html> Step Three: Troubleshoot problems with running errors Press F5 to start the debugger. Because SQL Server Express is not installed, you will see the error message shown in the following illustration                                           Figure 6 Then we can use the VS 2010 installation file to add the installation to solve this problem, and you can also solve it by command line, In the Start menu, click Windows Azure SDK Command Prompt to enter the command line window, as shown in:                                            Figure 7 Enter dsinti/sqlinstance in the command line window below:. (meaning: "dsinit/sqlinstance: Your SQL instance name", we have this machine here, so it is.)                                           Figure 8 Then click the OK button below toNew to run the program.                                           Figure 9 Step four: Run the program again, get the correct results run the program again, you will see the following page, which means that the Windows Azure program you created will work and get the results you want, if you are more careful, You will find that it is borrowed from the local IIS to host, the address is: http://127.0.01:81/Default.aspx:                                           Figure 10 After the steps above, we have created the first cloud program, The next thing to do is deploy to the so-called cloud. Step five: Observe the local cloud simulator if you are careful enough, you will find that the taskbar has a more than one program icon, see the following figure 1 mark:                                           Figure 11 This is the manager for dev fabric and dev storage. The legendary cloud simulator,This simulator allows us to test our own programs locally to be able to function on Windows Azure platform. Normally, if the program passed in the local test is uploaded to the Windows Azure platform, it will work, but there are special cases that we'll talk about later. Click on the 2 tag on the map to enter the dev fabric manager below:                                            Figure 12 from the dev fabric manager above, we can see the program we are running and the status of execution, which can help us to track and Debug. Click on the 3 tag in Figure 11 to enter the Dev Storage Manager below, Windows Azure provides the blobs,tables and queues three storage mechanisms for the application, and you can turn on or off some of the storage mechanisms in this interface.                                           Figure 13 for the above features, we will not do too much discussion in this article, will be in a special article to do detailed introduction. Six. Account application before deployment, we need to have an account, if no account needs to be registered from http://www.microsoft.com/windowsazure/offers/here to purchase, the following page                                           Figure 14 purchased and activated to pass https://windows.azure.com/Cloud/Provisioning/ Default.aspx Landing                                           Figure 15 After landing successfully, you will see the following main interface, in which you can create, manage your Windows Azure, SQL Azure, and AppFabric.                                            Figure 167. Deployment Step One: Publish a project after an application has been developed and tested locally, you can deploy to the cloud, and in Visual Studio's Solution Explorer window, right-click the Firstcloudapp item and click the Publish option. The following figure:                 &Nbsp;                         Figure 17 There are two options for publishing your project, the first is to create a cloud package, manual upload, and the second is to set up information automatically uploaded. Because the next section we will analyze its internal principle, so we choose the first way here, the following figure:                                           Figure 18 Click the OK button to wait for Visual Studio to create a compressed package and automatically eject the compressed Package window. The package and configuration files are shown below:                                           Figure 19 Step Two: We entered the Live ID and password in front of the Windows Azure Management site and logged into the Windows Azure Management site. You see this page lists the Windows Azure services we can use, and of course your number of items will vary depending on the service you buy, and here we need to create a service to host our program. You can click the following figure Mark 1 or mark second to create our service:             &NBsp;                            Figure 20 Step three: Create hosted Services as the first deployment, we need to first create a new hosted Services to host our program. Click the new service link:                                           Figure 21 pops up the following page, fills in the hosted Services label name and enters the description of the hosted services, then clicks on the Next button:                                           Figure 22 Enter the domain name you want, and then click the Check Availability button to check if the domain name is available, and then set the location of the server, since I am in Singapore, so choose Southeast Asia, if in mainland China, You can choose East Asia. Finally click the Create button to complete the creation:                & NBsp;                         Figure 23 Step four: Upload and deploy the program now hosted services has been created to complete. We can see the hosted Service we just created on the Web page, as shown in the following figure, Mark 1 can modify the description of the program. Mark 2 Deletes the service we just created. Tags 3 and 4 are the two environments in which we have just created a service, and Windows Azure is user-friendly in this area, offering staging and production two environments to deploy our applications, similar to our actual project processes and providing us with greater flexibility. Tag 5 provides us with a very important feature that you can use to protect your application with a certificate.                                           Fig. 24 Click on the Deploy button on the figure staging to eject the following page. Select the two files generated in step one and upload them. Enter the. cspkg file path in the Creator package column. Enter the. cscfg file path in the revisit Settings column. Click Deploy:                                           Figure 25 Step five: Start and test the program after clicking the Deploy button, see the following page, and then wait a long time (depending on the size of your project):

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.