[ASP] IIS Classic and inheritance modes

Source: Internet
Author: User
Tags configuration settings website server

Introduction

Because you want to deploy the project to the customer, you've researched the integration and classic patterns in IIS, and here are some notes. Hope to help you.

IIS7.0 and IIS6.0

The IIS7.0 Web application has two configuration modes: Classic mode and Integrated mode. The Classic mode is to be compatible with previous versions, using the ISAPI extension to invoke the ASP. Web applications that were originally run under IIS6.0 migrated to IIS7.0, so that the code would run normally without modification as long as the application was configured in Classic mode. Integrated mode is a consensual request processing pipeline that combines the ASP. NET request pipeline with the IIS core pipeline, which provides better performance, enables modularity of configuration and management, and increases the flexibility of extending IIS with managed code. If the old Web application is running in IIS7.0 Integrated mode, you may need to modify the application's Web. config file, especially if you are using a custom module that implements the IHttpHandler interface. IIS7.0 applications that enable colleagues to support two modes on the same server.

IIS6.0 in the ASP. NET MMC snap-in to configure administrative domains for ASP. asp.net,7.0 in the admin domain IIS management is more tightly integrated, regardless of the individual snap-ins, all IIS and ASP. NET configuration is done using IIS Manager. IIS7.0 configuration information is based on the. NET Framework configuration system, Therefore, the Web. config file for the application running in IIS7.0 contains both the website server and the ASP. NET configuration settings, such as the ability to set the extension and file mappings in the Web. config file (IIS6.0 must be configured in IIS).

Changes to the Web. config file

The system.webserver section specifies the IIS7.0 settings that apply to the Web application, whose parent node is a configuration that can be set up in the node:

The default document (Defaultdocument) that the Web server returns to the client when the request is to contain the specified resource;

L Compression settings for response (httpcompression)

L Custom Head (Httpprotocol section of Customheaders)

L Module (modules)

L processing program (handlers)

Some of these settings apply only to Integrated mode, not to Classic mode, Applications running in Classic mode ignore all managed code modules and handlers specified in the system.webserver section of Web. config, where Web applications should be determined in httpmodules and httphandlers of the system.webserver section Modules and handlers.

Migrating a Web application to Integrated mode

Web applications that do not contain custom modules or handlers normally work in IIS7.0 Integrated mode without changes. For Web applications that depend on custom modules or handlers, you need to perform the following steps to enable them to run in Integrated mode:

Use one of the methods described in migrating the Web config file to the Integration Mode section later in this topic to register custom modules and handlers in the system.webserver section of the Web. config file.

L only define event handlers for HttpApplication request pipeline events (such as BeginRequest and endrequest) in the Init method of the custom module.

L Make sure that you have resolved upgrading ASP. Applications to IIS 7.0:differences between IIS 7.0

"Known Differences between Integrat Integrated mode and Classic mode (the difference between an ASP. 7.0:iis 7 and Classic modes) Ed mode and Classic mode (known differences between integrated and classic modes) are discussed in the section.

The modules that implement the IHttpModule interface are called managed code modules because they are built using the. NET Framework. Managed code modules can be registered at the server level or at the application level. A native code module is a DLL (unmanaged code) that is registered only at the server level. In Integrated mode, core ASP. NET features, such as session state and forms authentication, are implemented in the form of managed modules.

When migrating applications from Classic mode to Integrated mode, you can retain custom modules and handler registrations in Classic mode, or you can remove these registrations.  If you do not remove httpmodules and httphandlers registrations that are used in Classic mode, you must set the validateIntegratedModeConfiguration property of the validation element to False To avoid errors. The validation element is a child element of the system.webserver element. For more information, see the section "Disabling the Migration message" (disabling migration messages) in ASP. Integration with IIS 7.0 (set ASP. NET with IIS 7).

Migrating the Web. config file for use in Integrated mode

If a module or handler is defined at the application level, the module or handler is not called automatically. This involves

A module or handler that is defined in an assembly under the Bin folder, defined as a source code under the App_Code folder, and not registered and defined in the system.webserver section of the Web. config file. In order for a module or handler to participate in an integrated mode request pipeline, you must register the module or handler by using one of the following methods:

L edit the Web. config file directly and add the modules or handlers element to the system.webserver element. Note that the element names are different than the Classic mode: modules and handlers correspond to httpmodules and httphandlers in Classic mode, respectively.

L Use IIS Manager to configure the module or handler.  For more information, see Configuring Handler Mappings in IIS 7.0 (configuring Handler Mappings in IIS 7.0) and configuring Modules in IIS 7.0 (IIS 7.0 In the configuration module).

L Use the IIS 7.0 command-line tool (Appcmd.exe). For more information, see Configure Settings for a site, application, Virtual Directory or URL by using Appcmd.exe (use Appcmd.exe to configure sites, Settings for the application, virtual directory, or URL).

Classes and properties that use integrated patterns

When you use an application in IIS 7 Integrated mode and the. NET Framework version 3.0 or later, you can make

Use the following classes and members that are not available in Classic mode:

The Substatuscode property of the HttpResponse object, which you can use to set code that is useful in cases where failed request tracing is configured. For more information, see Troubleshooting Failed requests using Failed request tracing in IIS 7.0 (use the tracing feature in IIS 7.0 to troubleshoot requests that fail).

The Headers property of the HttpResponse object, which can be used to access the response header.

L HttpContext the Ispostnotification and Currentnotification properties of the object, which can be used when providing handlers for HttpApplication events.

L HTTPREQUEST the Headers and ServerVariables properties of objects that support write functionality.

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.