The classic mode is to be compatible with previous versions, and ISAPI extensions are used to call ASP. NET Runtime Library, the Web application originally running in IIS6.0 to IIS7.0, as long as the application is configured in the Classic mode, the code can run normally without modification. The integration mode is a unified request processing pipeline, which combines ASP. the NET request pipeline is combined with the IIS core pipeline. This mode provides better performance, implements configuration and governance modularization, and increases the flexibility when using the managed code module to expand IIS. If the old Web application runs in IIS7.0 integration mode, you may need to modify the web. config file of the application, especially when you use a custom module that implements the IHttpHandler interface. IIS7.0 supports two modes of applications on the same server at the same time.
ASP. net mmc snap-in is used to configure ASP. NET, 7.0 in ASP. NET application management domain IIS management is more closely integrated, there is no separate management unit, all IIS and ASP. NET configuration is completed using the IIS manager. IIS7.0 configuration information is based on.. NET framework Configuration System. the config file contains both the web server and ASP. NET configuration settings, such as web. set the extension and file ing in the config file (IIS6.0 must be configured in IIS ).
Changes in the web. config file
The system. webServer section specifies the IIS7.0 settings applied to web applications. Its parent node is configuration. The content that can be set on this node includes:
When the request does not contain the specified resource, the Web server returns the default document (defaultDocument) to the client; the response compression setting (httpCompression) custom header (modumheaders in the httpProtocol section) module (modules) handlers)
Some of these settings apply only to the integration mode, but not to the classic mode. For example, applications running in the Classic Mode ignore the web. config system. all the managed code modules and handlers specified in the WebServer section. In this mode, web applications should be. define modules and processing programs in httpModules and httpHandlers of the web section.
Migrate Web applications to the integration mode
Web applications that do not contain custom modules or processing programs normally work in IIS 7.0 integration mode without changes. For Web applications that rely on custom modules or handlers, perform the following steps to enable them to run in integrated mode:
Use one of the methods described later in this topic to migrate the Web Config file to the integration mode section and register the custom module and handler in the system. webServer section of the Web. config file.
Only the event handlers for HTTP application request pipeline events (such as BeginRequest and EndRequest) are defined in the Init method of the custom module.
Make sure that you have fixed Upgrading ASP. NET Applications to IIS 7.0: Differences between IIS 7.0 Integrated Mode and Classic mode (set ASP. NET application to IIS 7.0: the difference between IIS 7.0 integration mode and Classic Mode) the issues discussed in the "Known Differences Between Integrated Mode and Classic Mode" section (Known Differences Between the integration Mode and the Classic Mode.
Modules that implement the IHttpModule interface are called managed code modules because they are generated using. NET framework. You can register a managed code module at the server or application level. The local code module is a DLL (unmanaged code) registered only at the server level ). In integration mode, core ASP. NET functions, such as session Status and Forms authentication, are implemented in the form of a hosting module.
When migrating an application from the classic mode to the integration mode, you can retain the custom module and Handler Registration in the Classic mode, or remove these registration. If you do not remove the httpModules and httpHandlers registration used in Classic mode, you must set the validateIntegratedModeConfiguration attribute 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 "Disabling the migration message" in ASP. NET Integration with IIS 7.0 (Integrating ASP. NET with IIS 7.0.
Migrate the Web. config file for use in integration mode
If the module or handler is defined at the application level, the module or handler is not automatically called. This involves a module or handler that meets the following conditions: it is defined in the program set in the Bin folder; it is defined as the source code in the App_Code folder; it is not defined in the Web. the system. register and define in the webServer section. To enable a module or handler to participate in the integration mode request pipeline, you must register the module or handler using one of the following methods:
Directly edit the Web. config file and add the modules or handlers element to the system. webServer element. Note that the element names are different from those in Classic Mode: modules and handlers correspond to httpModules and httpHandlers in Classic Mode respectively.
Use the IIS manager to configure the module or handler. For more information, see logging ing Handler Mappings in IIS 7.0 (Configuring Handler ing in IIS 7.0) and logging ing Modules in IIS 7.0 (Configuring the module in IIS 7.0 ).
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 Site, Application, Virtual Directory, or URL Settings ).
Classes and attributes used to use the integration mode
When using applications in IIS 7.0 integration mode and. NET framework 3.0 or later, you can use the following classes and members that are unavailable in Classic Mode:
The SubStatusCode attribute of the HttpResponse object, which can be used to set useful code when a failed request trace is configured. For more information, see Troubleshooting Failed Requests Using Failed Request Tracing in IIS 7.0 (use the tracking function in IIS 7.0 to solve the Request failure problem ).
The Headers attribute of the HttpResponse object, which can be used to access the response header.
The IsPostNotification and CurrentNotification attributes of the HttpContext object can be used when handling the HttpApplication event.
The Headers and ServerVariables attributes of the HttpRequest object. They support the write function.