Azure Developer Task Three: Understanding Azure Applications

Source: Internet
Author: User
Keywords This the application we can this the application we can
Tags application applications azure applications azure developer code configuration control data

The application that is designed and developed as a managed service for Windows Azure consists of two parts:

1, managed code

2,xml configuration file

Managed code corresponds to different roles

The XML file corresponds to different configuration settings

We can take a look at the following diagram, which details what components are primarily included in Windows Azure applications:

Note: This is a picture in the Windows Azure SDK.

Next, we will carefully analyze each of the components mentioned in the above picture.

First, the character.

There are three types of roles

1,web role

2,worker role

3,VM role

Web role

1, this is a custom-defined role for IIS.

2, if we choose this type of role, IIS will be automatically configured.

3, this role is primarily used to get input.

4, this role has been configured appropriately for HTTP requests.

5, which contains Web sites or other code that is supported by IIS.

6, it will contain some ASPX pages, or it may contain some WCF services. Any application that is supported by IIS can be used as a web role.

7, any application can be used as a web role, as long as it supports the HTTP protocol.

8, when we use the WCF service as a Web role in Windows Azure, we need to make sure that the bindings used in the WCF service are "BasicHttpBinding". Using WCF services as a Web role, we cannot use other bindings.

Web role improvements in Windows Azure SDK 1.3

1, all IIS features are supported.

2,web applications and sites are fully operational under IIS.

The 3,web role uses application domains in exactly the same way as IIS.

The biggest improvement is that now we can think of multiple sites or applications as a web role.

When creating an azure project, we can choose the type of Web role that we want to add for this application. The templates that are already installed include:

1,asp.net Web Role

2,asp.net MVC Web Role

3,WCF Service Web Role

4,cgi Web Role

In the Windows Azure project you just created, you can see that the wizard will automatically create two types of profiles for you.

In the Serviceconfiguration.cscfg file, we can specify the number of instances of the Web role:

Worker role

It is mainly used for background tasks. It is noteworthy that the worker role does not support IIS. Therefore, it can handle any type of application, including unmanaged code. The worker role does not have to interact directly with the user, so it can be a hit when it comes to processing tasks that are asynchronous and take a long time to complete.

Main uses of the worker role

1 for tasks that do not require a user to wait.

2 for those asynchronous tasks.

3, for running non-HTTP services (for example, TCP services).

4, hosting applications that do not require user input.

Differences between worker roles and web roles

Let's understand the difference between web roles and worker roles:

The 1,web role is a Web application that obtains HTTP input from the user and is supported by IIS. The worker role does not support IIS. This is the main difference between the web role and the worker role.

The 2,web role is user-oriented, and the worker role acquires input from the Web role, primarily for performing bulk operations asynchronously.

3, in web roles, threads are managed through IIS, and in the worker role, threads are managed by developers or by ourselves.

4, in the worker role, we must provide the Run method to start the process.

The security parameters for the 5,web role and the worker role are not the same.

6, for IIS and network services, the default is to support certificate-based ACLs (Access control List), which in the worker role must be managed by the developer themselves.

In the Csdef file, the worker role is defined as follows, in the following configuration file, the name of the worker role is "WokerRole1":

<workerrole name= "WorkerRole11" >

<Imports>

<import modulename= "Diagnostics"/>

</Imports>

</WorkerRole>

The worker role class consists primarily of two methods:

VM role

The third type of role is the VM role. This is a very special role that is primarily used for operating system upgrades in virtual machines.

Web roles and worker roles run on a virtual machine, and the VM role is a virtual machine that can fully control the various operations on the virtual machine.

We can use VM roles to control operating systems and upgrades in virtual machines, while operating systems are instances of VM roles. This role is best suited for migrating applications that run as managed services in Windows Azure.

A VM role is defined as follows:

<virtualmachinerole name= "Machinerole" vmsize= "Medium" >

<Imports>

<import modulename= "RemoteAccess"/>

<import modulename= "Remoteforwarder"/>

</Imports>

</VirtualMachineRole>

Configuration file

So far, we've figured out three different types of roles. Next, let's take a look at the two types of configuration files that are included in Windows Azure applications.

Serviceconfiguratiobn.cscfg

You can also update the configuration file without stopping the Azure service. This file mainly contains the following information:

1, number of instances of the role

2, different types of values set.

1, the number of instances refers to the number of instances of the web role or worker role that will be run.

2, in the above configuration file, we see that the application is using local development memory.

Servicedefinition.csdef

This file contains the following information:

1, the various roles used by this service.

2, about the use of this service "certificates" information.

3, "Input end point" and "Internal end point" for this service.

4, this service requires local disk storage.

5, the configuration settings used by different roles.

This configuration defines the Web role or worker role. Let's understand each of the sections of the file in one place.

<Sites>

<site name= "Web" >

<Bindings>

<binding name= "Endpoint1" endpointname= "Endpoint1"/>

</Bindings>

</Site>

</Sites>

This section contains definitions for sites and Web applications. These sites and Web applications are hosted in IIS 7.

<Endpoints>

<inputendpoint name= "Endpoint1" protocol= "http" port= "no"/>

<internalendpoint name= "Endpoint2" protocol= "tcp" port= "8989"/>

</Endpoints>

In this configuration file, there are two types of "end point", "Input end point" and "Internal end point".

Input end point contains the definition of "end point" that is used to contact the managed service.

"Internal end point" contains the definition of "end point" for communication between roles.

<Certificates>

<certificate

Name = ""

Permissionlevel = ""

Storelocation = ""

Storename = ""/>

</Certificates>

This section contains the certificates that the role requires.

<Impotrs>

<import modulename = "Diagnostics"/>

</Impotrs>

This subsection contains the definition of the import rule.

Storage services

The last component of the Azure application is the Azure Storage Service. There are three kinds of azure services:

1, for unstructured data (BLOBS)

2, for structured data (TABLES)

3, message delivery between applications and services (QUEUES)

BLOBs is mainly used for large data storage. There are two types of BLOB storage, "Block BLOB" and "PAGE blob." Azure Table is used to store structured data. The CRUD (create,retrieve,update, and delete) operations can be implemented using the OData protocol, or you can use the same syntax as the WCF Data service. Each row in Azure Table is uniquely identified by the row Key and Partition key.

SQL Azure

You can also use SQL Azure to achieve the purpose of storage.

Conclusion

In this article, we have a brief introduction to a Windows Azure application. This paper focuses more on theory. In the next article in this series. We'll use walkthroughs to study Windows Azure applications. Thank you for your reading.

Original name: Windows Azure for Developers Task 3:understanding Windows Azure Creator Author: Dhananjay Kumar

Related Article

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.