. NET Framework and network services (next)

Source: Internet
Author: User
Tags contains html form http post http request implement soap new features object model
Network NET Framework and network services (next)
(Author: MSDN February 06, 2001 10:47)

   Data Access Services
Almost all network services need to query and update persistent data, whether in simple files, related databases, or other storage types. To provide access to data, the service framework includes the ActiveX Data objects+ (ado+) class library. As the name implies, Ado+ developed from ADO. ado+ provides data access services for network-based applications and services. Figure 1 illustrates the architecture of the ado+, indicating that any data, regardless of how the data is actually stored, is manipulated in the form of XML or related data.

ado+ defines the classes that link the Data Warehouse, send commands to the Data Warehouse, and obtain results from them. These classes are implemented by the managed data provider (managed-provider). The links and command objects in ado+ look the same as in ADO, and a new class named DataReader provides the ability to get results through high-performance API streams. DataReader is functionally similar to an ADO recordset (Recordset), but DataReader is designed to minimize the number of objects generated in memory to improve performance and avoid garbage accumulation. The. NET framework contains the managed data providers for Microsoft SQL Server and any data warehouses that can be accessed through OLE DB.

One of the major innovations in ado+ is the introduction of Datasets (Datasets). A dataset is a high-speed buffer in memory that provides a data graph. Datasets are ignorant of data sources and can be generated and populated by programs or by the transfer of data from the Data warehouse. Regardless of where the data is obtained, the dataset is manipulated by using the same program template, and it uses the same data buffer. Use. NET platform developers can replace the disconnected recordset in traditional ADO with a dataset.

An interface object named DataSetCommand that is exposed by the managed data provider to the Data Warehouse and dataset. DataSetCommand uses ado+ links and commands to extract datasets from the Data Warehouse and resolves changes that occur in the dataset to the Data Warehouse.

Just as DataReaders shows a valid stream access for related data, XmlReaders shows streaming access to XML data. Developers use DataNavigator to scroll and edit XML documents in memory. DataNavigator is functionally the same as document Object Model (DOM), but it is more efficient and provides an object template that maps relational data tables well. Ado+ provides a XmlDocument class for developers who want to continue using the DOM as an XML object template instead of using a more efficient datanavigator template.


Figure 1 ado+ Architecture

   Form Application Template
Conceptually, the top of the service framework is two application templates: The Windows Form Application template and the network application template. Although this article focuses on using the microsft.net framework as a way to develop network services and network applications, the framework can also be used to develop more traditional windows-based applications (which, of course, can also use network services).

Developers who write Windows client applications can use the win form Application template to take advantage of Windows rich user interface features, including current ActiveX controls and new features of Windows 2000, such as transparent, layered floating windows. Developers will find the win Form programmable template and support for the design phase very intuitive.

The win form leverages the Microsft.net framework runtime to reduce the overhead of windows-based customer applications. As long as applications and components are used for win form applications, they can be safely executed on the client by the framework security templates.

The Microsft.net Framework assembly template simplifies the configuration and versioning of applications. Applications can be formulated to use the shared components they use in compilation and testing. Instead of using any version of the component that happens to be installed on the client machine, this improves the reliability of the application and reduces the main factors that the application supports: incompatibility between user interface controls and other shared component versions.

   Network Application Templates
Built on the Microsft.net framework, network applications share a common application template. Contains network applications and network services that are used to generate Web pages viewed in a browser. The following is a detailed description of the active Server pages+ (asp+) Network application programmable template, as shown in Figure 2.

The asp+ is developed by the Active Server Page (ASP). Asp+ leverages common language runtime and service framework network applications to provide a reliable, automated, extensible host environment. Asp+ also benefits from the common language runtime integration template, simplifying the application configuration. In addition, it provides services that simplify application development, such as state management services, and high-level programming templates such as asp+ network forms and asp+ network services.

The core of asp+ is the HTTP runtime language, a high-performance running language for handling HTTP requests based on low-level architecture, similar to the ISAPI architecture provided by Microsoft Internet Information Services (IIS). As shown in Figure 2, the HTTP Runtime language (HTTP runtime) handles all incoming HTTP requests, resolves the URL of each requesting application, and then assigns the request to the application for further processing. The HTTP runtime language is multi-threaded and handles requests asynchronously, so poor application code cannot prevent it from processing new requests. and the HTTP runtime language assumes that failure must occur, so it can often be automatically recovered from an incident such as an access violation, a memory leak, a deadlock, and so on.

Asp+ uses microsft based on artifacts. NET Framework, so it obtains such advantages as Xcopy compounding, component parallel compounding, and xml-based compounding. Another major advantage of asp+ is that it supports real-time updates of applications. Administrators do not have to turn off the network server or even update the application file without stopping the application running. Application files are never locked, and files can be overwritten even when the program is running. When the file is updated, the system detects changes to the file, creates a new application instance with the new application code, and then passes the incoming request to the application. When all outstanding requests processed by an existing application instance are processed, the instance is destroyed.

In an application, HTTP requests (HTTP request) are routed through the HTTP module's pipeline and eventually arrive at the request handler. HTTP modules and request handlers are managed classes that implement special interfaces that are defined by asp+. This piping structure makes it easy to add services to your application: Just add an HTTP module. For example, security, state management, and tracking are implemented as HTTP modules. Advanced programmable modules, such as network services and network forms, are commonly used for request handlers. An application can link multiple request handlers, each handler corresponds to a URL, but all HTTP requests are routed through the same pipeline.

The network is essentially a stateless model, and there is no connection between HTTP requests, which makes it difficult to write network applications, because applications often need to maintain a state across multiple requests. Asp+ enhances the state management services introduced by ASP to provide three types of state for network applications: Applications, Sessions, and users. As in ASP, application state is specific to an application instance and is not persisted. Session state is specific to the session between a user and the application. Unlike ASP session state, the asp+ session state is stored in a separate process and can be configured to be stored on a separate machine. This makes the session state useful when the application is extended in a network cluster (Web farm). User State is similar to session state, but usually it does not time out and is permanent. Therefore, user status is useful for storing user parameters and other personalized information. All state management services are implemented as HTTP modules, so they can easily be added to or removed from the application pipeline.


Fig. 2 asp+ Network Application Model

If additional state management services are required in addition to the services provided by asp+, they can be provided by a third party module.

Asp+ also provides high-speed buffering services to improve performance. Output buffering can completely save Web page translations, segment buffer storage section of the Web page. Because the corresponding classes are provided, applications, HTTP modules, and request handlers can store any number of objects in the cache whenever necessary.

Let's take a look at two advanced programmable modules built on asp+ programmable modules: asp+ network forms and asp+ network services.

   asp+ Network Form
Network forms bring the high productivity benefits of Visual Basic forms to the development of network applications. Network forms Support Traditional ASP syntax that mixes HTML content with scripting code, but it proposes a more structured approach to separating application code from user interface content. The introduced network form controls are used to provide a mechanism for encapsulating common user interface elements. These new features make the development tools support the design module while supporting the VB small application.


Figure 3 asp+ Network Services

The Network form control is responsible for building the user interface, typically in an HTML form. Asp+ provides a set of network form controls that map traditional HTML user interface widgets (including list boxes, text boxes, and buttons) and a set of additional network controls (such as calendars and ad boards). An important feature of these controls is that they can be written to fit the client's capabilities; the same Web page targets a wide range of client platforms and form factors. In other words, a network form control can "sniff" the customer who is looking for the form, and then return to the appropriate user experience-either HTML3.2 for low-level browsers or dynamic HTML for IE5.0.

Considering that the network is a stateless join model, a complex problem facing network application developers is that they respond to the interaction of the user with the Network-based interface. The network leverages the asp+ architecture to provide a rich set of services to help developers build interactive Web pages. The complexity of the state management of user interaction with Web pages is hidden by asp+ network forms and network form controls. For developers, the rich data-binding services provided make it easy to display data from data access services.

The separation of code and content enables asp+ Web pages to be dynamically compiled into controlled classes to improve performance. Each incoming HTTP request is passed to a new Web page instance, so the developer does not need to care about thread security issues in the code.

   asp+ Network Services
The Asp+ Network Service architecture provides an advanced programmable template for establishing network services with asp+. Although it is not necessary to use a network service platform to establish a network service, it offers many advantages that simplify the development process of the application, and the programming model it uses is familiar to developers working with ASP or VB. With this programmable model, developers do not need to understand HTTP, soap, or any other network service specification. The asp+ network services programmable model is shown in Figure 3.

Developers use asp+ to generate an extension of. asmx file, and make this file a part of the network application, you set up a network service. The ASMX file contains a reference to the managed class, or the definition of this class. This class is derived from the WebService class provided by asp+. When the public class method WebMethod the attribute on the tag, it becomes a network service method, which is invoked when the HTTP request is sent to the URL in the asmx file. You don't have to create a contract for your Web service by hand. When a request is made by the caller, asp+ checks the metadata of the class to automatically generate an SCL file.

Customers can submit requests via SOAP, HTTP GET, and HTTP post. The Convention for encoding methods and parameters is: HTTP GET, which will be compiled into a query string, and an HTTP POST that will be compiled into form data. The mechanisms of HTTP GET and HTTP POST are not as powerful as soap, but they make it unnecessary for customers to support soap when accessing network services.

The asp+ Network Service model assumes a stateless service structure. Stateless structures are generally more scalable than stateful structures. Each time a service request is received, a new object is generated, the request is converted to a method call, and the object is destroyed when the method call returns. If these services need to maintain state across requests, they will use the Asp+ State Management service. asp+ Network services run in the network application model, so they get all the security, compounding, and other benefits of the model.

The Asp+ Network Service also provides a managed proxy tool that generates classifications for the network services described in the SCL file. The Agent builder maps the messages described in the SCL file to methods in the managed class. The agent hides all network and boot devices from the application code, so using network services looks just like using other controlled code. The proxy will use the SOAP Link Network Service preferentially, but it also supports HTTP GET and HTTP POST mechanisms.

   Conclusions
Network services provide a simple, flexible, standards-based model for binding applications on the Internet while maximizing the reuse of existing architectures and applications. Web applications can be easily integrated with locally developed services or existing services, regardless of the development platform, the development language, or the object model used to implement any of the components of a service or application.

The Microsft.net framework provides developers with an extremely convenient development environment that simplifies the establishment, deployment, and continuous development of secure, reliable, scalable, and highly available network services.


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.