Editor's note:
The layer-3 architecture adds an "intermediate layer" between the client and the database, also known as the component layer. The layer-3 system mentioned here does not refer to the layer-3 physical architecture, instead of simply placing three machines as the layer-3 architecture, or not just B/S applications as the layer-3 architecture, layer 3 refers to the logic layer 3, even if these three layers are placed on one machine.
Deploy a three-tier architecture with ASP. NET
ASP. NET can use the. NET platform to quickly and conveniently deploy a three-tier architecture. The revolutionary change of ASP. NET is that event-based processing is also used in webpages, and the background of processing can be specified.CodeFile, you can use C #, VB, J # As the background code language .. Net, and the backend code can conveniently use custom components through naming controls. The display layer is placed on the ASP page, and the database operations and logic layers are implemented by components, which facilitates the implementation of the three-layer architecture.
The following is a small example of creating a message book for the implementation of each layer.
First, create a database gestdb in the sqlserver database and create a table in gestdb: Guestbook
Step 1: Open vs. net, click File-New-blank solution, select visal C # project in the pop-up new project, and select ASP. NET web application as the templateProgram. Name this solution geustbook at the location, as shown in.
Step 2: Create a database access control. Click "OK ". In Solution Explorer on the right of the window, right-click solution Guestbook and choose add.-> new project. In the following window, select a class library as the template, enter the name and location. Note that this class library theoretically has nothing to do with the message book project, so the storage location can be arbitrary.
Step 3: Create a logic processing layer. In step 2, create another control businesslayer. This control is used to call database controls and encapsulate all logic processing in the message book. As shown in.
Step 4: reference. Because businesslayer uses the web control of the system and the dblayer just created, you must add references to the two. Right-click businesslayer's "Reference" and select. Net's "system. Web. dll" double-click to select
Click "dblayer" of the project and double-click it.
Step 5: Associate the guestbook ASP. Net project with the logic layer and add reference as well. Note: dblayer has been referenced in businesslayer. You only need to reference businesslayer in guestbook.
Now your guestbook solution resource manager should be shown in:
If not, check the steps above for errors.
Through the above steps, the three-tier architecture of ASP. NET has been successfully deployed. At the guestbook layer, we place the ASP page displayed by the application. At the businesslayer layer, we implement all the business logic code at this layer. The datalayer layer mainly processes database operations for the businesslayer to call.
As long as you implement a specific class in each layer, you can successfully implement a three-tier application.
Summary:
This article briefly describes the three-tier architecture software system idea, through an example of a message book mainly introduces the specific implementation method of deploying the three-tier structure with ms. net.