ASP is a dynamic site design technology based on Windows NT 4.0, Windows 9X, which enables us to create dynamic, interactive, high-performance Web applications.
Compared with traditional dynamic technologies, ASP has the features of direct and HTML integration, easy to create, no need for manual compilation, object-oriented and easy to function extension through active Server component, so it is internet/in enterprise class There is a bright future in intranet applications. However, for different business logic, we need to improve the business computing ability of ASP pages by self-made function components and improving software architecture. The following are specific practices:
Using a homemade Feature Component object in an ASP page
As an integral part of IIS, ASPs provide an integrated development environment without compilation, and developers can combine HTML, VBScript, or JScript, ASP scripts, and ActiveX components to create a dynamic, powerful Web application system. An ASP script is equivalent to a binder that glues together a component with a specific function to form the final software PRODUCT. Although the ASP provides many built-in objects and components, for complex business applications, it is necessary to develop the component objects with certain characteristics according to business requirements to accomplish special tasks. We can develop the following two types of component objects using languages such as Visual C + +, visual Basic, Delphi, and Java:
1. A .dll file, packaged by a class, called an ActiveX DLL. After registering with the Registrar, you can refer to the "Set Object name = Class name" In the ASP script. The object runs in the background of the server in this use, and the results of its operation are used by the system's automatically generated HTML to the front-end browser. This class of components is used to handle business logic calculations, often referred to as transaction logic units.
2. Generate .ocx files, generally as visual objects, called ActiveX control. When the component is finished and packaged as requested, the .cab file is generated, which we can embed directly into the .asp home page. Inserts on the page need to be referenced using the markup of the HTML language. Objects are downloaded from the server in this way, and then run in the client's browser. The first download is expanded to the relevant .dll and .ocx files for local installation registration. When you use it later, you can get it directly from the local, without having to repeat the download every time. This class of components is commonly used to perform information performance and display tasks in the front-end browsers.
Using MTS to build a practical three-tier architecture
In the browser client/web application Server/Database server architecture, IIS only provides multithreaded support for the page and is not responsible for managing the component itself. When multiple users access an ASP Web page embedded with an ActiveX DLL component, the server-side network congestion will be caused and the system performance will be degraded. To effectively support multiuser access to components, Microsoft has launched the MTS (Microsoft Transaction server) Transaction Server. MTS is a powerful development environment that provides an application programming model for developing and configuring distributed, component-based applications and a basic environment for running a program that can be easily used to develop and configure high-performance, measurable, and reliable Internet and intranet enterprise-class applications. It provides a number of services such as data connection buffering, thread management and transaction management, which solves a series of problems such as frequent access to backend database by multiple clients. IIS takes care of the pages, and MTS is responsible for the services and management of the embedded components in the page, combining them together to form the application server in the middle tier, thus building a practical three-tier architecture.
The software environment required to install MTS is Microsoft Windows NT 4.0 or later, or Windows 9X with DCOM support installed (Windows 9X's DCOM support is installed by IE4.0). In a Windows NT environment, you must first install Windows NT Service Pack 3 or later, and then use the Windows NT 4.0 Option pack to install MTS. If you want the component to have access to the database, you need to use Microsoft SQL Server 6.5 or later. If you plan to create an Internet application, the server side should use IIS4.0 or later, and the client should be IE4.0 or later.
MTS has an intuitive and user-friendly interface that is simple to operate. The general steps for adding components to MTS are as follows:
1. Create an ActiveX DLL with a tool language that supports the development of ActiveX;
2. Registration of the ActiveX components developed;
3. Enter transaction Server Explorer and create an empty package using the "Install package" option;
4. Open the component group of the empty package and add the registered ActiveX DLL to it;
5. Use the ActiveX DLL in the ASP page;
6. Adjust the Registrar's service parameters to meet the actual application needs.
Thereafter, when the component is invoked again, MTS automatically takes over the request from the client and provides a unified service.