ASP. NET manages websites (application pool, application push, and extended integration pipeline)

Source: Internet
Author: User
ArticleDirectory
    • Use application push
    • Extended integration Pipeline

ApplicationProgramThe pool can group similar or related applications to simplify configuration and management. Similarly, applications allocated to different application pools are independent of each other, so that problems in an application pool do not affect applications in other application pools.

No hard or fast rules are assigned to the application pool. You can group performance indicators because they have similar performance indicators, or belong to the same department, or any other reason that makes sense to the environment. Where,The most useful feature is to allow different application pools to use different versions of the. NET Framework..

IIS 7 automatically creates several application pools. You can view and manage the application pools through the IIS Manager:

    • Name: The application pool cannot be modified after it is created.
    • Status: Displays whether the application pool is running, that is, whether the application requests in the application pool are responded.
    • Managed pipeline Mode: IIS 7 supports integration and classic mode.
    • Identifier: Windows account for the application running in the application pool
    • Applications: Number of applications allocated to the application pool.

 

1. Create a new application pool

Use "add application pool" on the right of the IIS manager to create a custom application pool. Enter a name and select a mode (Classic mode is used to ensure compatibility with old applications ).

2. Allocate the application to the application pool

In IIS manager, select an application and click "Basic settings" in "operations" on the right to select the application pool allocated to the application:

3. Start and Stop the application pool

Start and Stop whether the request corresponding to the application is responded. The "recycle" Operation resets the application pool, which is very useful for handling problems that are gradually generated and difficult to diagnose.

4. Parallel Execution

The application pool allows you to run different versions of ASP. NET applications on the same server.If you want to modify the. Net version of the website created using the vs project, you need to modify the settings of the project and redeploy it. Otherwise, the configuration error is displayed when you request the website..

 

Use application push

It takes a long time to process the first request and return it to the browser, but the subsequent requests will be much faster. This is because IIS 7 does not process the deployed files until the first request occurs. At this time,Prepare applications for IIS; websiteCodeSome are compiled, database connections are created, and data is loaded. This takes a lot of time, so the first request is so slow.If you restart IIS, this process will be executed again.

For large and complex applications, it may take a long time to respond to initial requests. The application prefetch function is newly added to IIS 7.5. For each application configured with the push function, IIS 7 executes a set of requests at startup (specified by you), that is, when the first request of the real user arrives, all preparations are ready..

(You can use the aspnet_compiler.exe command line tool to execute pre-compilation to improve the initial performance of the application even if you do not want to use application push)

 

1. Prepare IIS 7

Use the webpi platform to download "application push for IIS 7.5" again. After the installation is complete, refresh or restart the IIS manager.

2. Configure application push

Double-click the newly installed "application push" icon. In the dialog box, perform simple settings.

 

Extended integration Pipeline

IIS 7 supports two request processing models. The first type is called "classic". It is a model supported by previous versions and is still supported for compatibility with old applications.The second is "integration", which provides better performance and a different model that extends IIS 7 through the ihttphandler interface. The integrated pipeline mode should be used by default..

 

1. Create a handler

Create a new class library project simplehandler and add the following class to implement the ihttphandler interface and generate the DLL file:

 
UsingSystem;

UsingSystem. Web;

 
 

NamespaceSimplehandler

 
{

ClassSimplehandler: ihttphandler

 
{

# RegionIhttphandler Member

 
 

Public BoolIsreusable

 
{

Get {Return True;}

 
}

 

 
Public VoidProcessrequest (httpcontext context)

 
{

 
Httpresponse response = context. response;

Response. Write ("<HTML> <body> );

Response. Write ("</H1> </body> );

 
}

 

 
# Endregion

}

 
}

 

2. Deploy the application

Copy the DLL file to the server and put it in the bin directory of the application root. If the bin directory does not exist, create it. Take the filecopy application deployed in the previous articles as an example:

3. Configure the Handler

Use IIS manager, select the application to be modified (filecopy application), and double-click the "handler ing" icon to open the "handler ing" interface:

Click "add managed handler" on the right of the window to open the dialog box. We want our handler to only use. the request ending with htest. enter the name of the class in the Type field. If the class has a namespace, The namespace must be included. Enter a name that can be recognized on the handler summary page in the Name field; you can also configure some special options for request restrictions. You do not need them now. Click OK.

Now we can see that the pipeline program we configured is displayed on the main interface:

 

4. Test the processing program

We request a URL that ends with. htest and is provided by the filecopy application. The following results are displayed:

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.