ASP development guidelines

zhaozj2021-02-08  293

The application server is, or will eventually be used by the web server, which is usually an IIS computer running the ASP page. ASP is the only client for your object. It brings special threads and safety considerations. Although many Web sites using ASP do not have components at all, in this article, assuming ASP is a bridge between the Internet client and components. The following ASP Components Guidelines (English) provide partitioning services ASP between ASP and components ASP is most commonly used to create HTML or XML files for clients on the server, so we mainly discuss this usage solution. This will lead a common problem. If the ASP page is on the server, do they belong to a part of the business layer? In the component world, the answer is usually. Although ASP is indeed running on the server, and may be with the application server in the same space, this cannot make it part of the business logic. With the development of user interface tools or with more business to business programs, this clear difference will be huge return. Say this, let us see some of the most important business strata and representation layer division guidelines:

Let the UI code are separated from the business logic. This includes writing code coupled to the UI, such as the MTS object using the ASP internal components, so that it is separated from the business logic code, as in different DLLs. Separate the transaction with the ASP page. Transaction ASP is very good in some cases, but components and multi-layer applications change this. Components should not rely on their transactions and business logic semanties by the client layer. Place the components (components that use requests and responses) and web servers in the same machine and / or process. If you will be placed on a remote machine using an object of an ASP internal component object, all calls to the internal components will occur in a callback form. Calling the IIS client is a COM server, which significantly reduces performance and complicates security configuration. These adjustments can be placed in a COM application labeled "library activation". The ASP exists on the server, so the ASP page must meet the resource sharing rules and remember scalability. Please see the details below:

In "Sessions", management should try to avoid user-specific status. Keep the ASP stateless and allow the resource pool to be allowed. When evaluating whether a code segment belongs to business logic or represents a layer, please ask yourself, "If I have to replace my ASP page with the button phone application, if the code is also useful?" If the answer is " ", Then try to divide it into business logic code or user interface helper code. If the code cannot be used after the client is changed, or if it is a help device that constructs the user interface, the code belongs to the representation of the service layer. It is in the ASP page, or in components that use the ASP internal components. It does not belong to business object components. Understanding the Differences of the Desktop and the ASP client ASP is a special client of the component, different from traditional single-threaded Win32 applications on the desktop. The main difference is summarized below.

Thread management: ASP is multithreaded client. This means that there are many concurrent activities to run together, may handle different ASP pages at the same time. This shows that the object is not called by the only user to exclusive system. This may have an unexpected reaction, for example, develop a bad habit: store the object in an ASP session or application variable. Security environment: ASP is performed by Internet Information Services 5.0 in the Web site, low, medium, and high isolation. Even these Web sites can have different security settings, allowed or refused anonymous access, verifying customers, and more. All of these settings have a large number of options, that is, different user accounts ultimately use your object. Easy to grow: This is not a technical problem, but a sub-effect of the facility provided by the web application. Traditionally, the user base is added to the desktop application, requiring a closer plan to transfer to the known quantity client. The ASP has changed the process. After starting and running, the ASP-Visual Basic app can easily open for local or worldwide staff, all business partners and all customers. You can use this way - a single email with hyperlinks can increase the user based on ten times. Is your app ready for this? The only way to understand the Web site to achieve the actual performance expectation. For more information on intensity testing, see the "Application Life Cycle" section. How should I use Visual Basic objects within ASP? Create and cancel your objects within the page. That is, the ASP page is not status as much as possible, depending on the session or application variable in the temporary state. Do not store objects in a session or application variable. This locks the ASP thread to your session and cancels the expected value of all scalability. That is, the number of users processed by the web server will not exceed dozens. If you need to store content in a session or application, make it a data instead of an object. There are many other guidelines that can be observed. We recommend that you read the columns "Servin 'IT Up" written by J. D. Meier on MSDN Voices. This column includes a lot of technologies, practices, and techniques to help develop scalable, reliable ASPs and component applications. Reference MSDN Voices: Servin Seminaronline: Using Custom COM Components Using Custom COM Components (English) MSDN MSDN MSDN MSDN MSDN MSDNLINE: Is "unit thread", that is, they are running in the STA unit. This means that if you create an object in the thread, all calls to the object must be served with the same thread. Many threads (from concurrent Web site users) use STA objects, which cause a series of activities, which may become bottlenecks in the application. In addition, the STA object created with Server.CreateObject is stored within the session, which can effectively link the execution thread to the current user, so that the maximum number of concurrent users of the application is limited to the default 20xN (N = processor number). Ways If you make an object in accordance with our recommendations, you do not need to store references for clients and store them within the application range. The client will be able to create, use and cancel their own objects independently. This reduces the need to maintain a specific object of the session, because they do not retain the state of the session. The recommended way is to enable the object state, which access the database or other storage area (such as cookies and ldap) when needed.

If you need to use a session or application range, use the data, not the object to process the data, stored here. You can create a class to encapsulate the processing of the desired value. Reference information: Do not store Sta objects (Q243543) (English) PRB in a session or application: Store the STA COM component in a session, which will lock the session in a single thread (Q243815) (English) information: Asp's components Thread Model Overview (Q243544) (English) Learn New Content in IIS 5.0 Internet Information Server 5.0 Add many new features. These improvements have been written in the MSDN article of J. D. Meier: along the ASP (English) in IIS 5.0. Below is an overview of the most important improvements in this article. Improved, excellent performance Server.Transfer and Server.execute methods Centralized Error handling improved browser features Improved script engine regular expression analyzer and ADO record set XML function integration new security, buffer, isolation, and management Important changes in Function Reference ASP (English) Information: New Features in ASP and IIS 5.0 (Q222487) (English)

转载请注明原文地址:https://www.9cbs.com/read-1711.html

New Post(0)