简体   繁体   English

IIS7中的“经典”和“集成”管道模式有什么区别?

[英]What is the difference between 'classic' and 'integrated' pipeline mode in IIS7?

I was deploying an ASP.NET MVC application last night, and found out that it is less work to deploy with IIS7 set to integrated mode. 昨晚我在部署ASP.NET MVC应用程序时,发现将IIS7设置为集成模式进行部署的工作量较小。 My question is what is the difference? 我的问题是有什么区别? And what are the implications of using one or the other? 以及使用其中一种的含义是什么?

Classic mode (the only mode in IIS6 and below) is a mode where IIS only works with ISAPI extensions and ISAPI filters directly. 经典模式(IIS6及以下版本中的唯一模式)是IIS仅直接与ISAPI扩展和ISAPI筛选器一起使用的模式。 In fact, in this mode, ASP.NET is just an ISAPI extension (aspnet_isapi.dll) and an ISAPI filter (aspnet_filter.dll). 实际上,在这种模式下,ASP.NET只是一个ISAPI扩展(aspnet_isapi.dll)和一个ISAPI筛选器(aspnet_filter.dll)。 IIS just treats ASP.NET as an external plugin implemented in ISAPI and works with it like a black box (and only when it's needs to give out the request to ASP.NET). IIS只是将ASP.NET视为ISAPI中实现的外部插件,并像黑盒子一样使用它(并且仅在需要向ASP.NET发出请求时才使用)。 In this mode, ASP.NET is not much different from PHP or other technologies for IIS. 在这种模式下,ASP.NET与PHP或IIS的其他技术没有太大区别。

Integrated mode, on the other hand, is a new mode in IIS7 where IIS pipeline is tightly integrated (ie is just the same) as ASP.NET request pipeline. 另一方面,集成模式是IIS7中的一种新模式,其中IIS管道与ASP.NET请求管道紧密集成(即相同)。 ASP.NET can see every request it wants to and manipulate things along the way. ASP.NET可以看到它想要的每个请求,并在此过程中进行操作。 ASP.NET is no longer treated as an external plugin. ASP.NET不再被视为外部插件。 It's completely blended and integrated in IIS. 它完全融合并集成在IIS中。 In this mode, ASP.NET HttpModule s basically have nearly as much power as an ISAPI filter would have had and ASP.NET HttpHandler s can have nearly equivalent capability as an ISAPI extension could have. 在这种模式下,ASP.NET HttpModule基本上具有与ISAPI筛选器相同的功能,而ASP.NET HttpHandler可以具有与ISAPI扩展几乎相同的功能。 In this mode, ASP.NET is basically a part of IIS. 在这种模式下,ASP.NET基本上是IIS的一部分。

Integrated application pool mode 集成应用程序池模式

When an application pool is in Integrated mode, you can take advantage of the integrated request-processing architecture of IIS and ASP.NET. 当应用程序池处于集成模式时,您可以利用IIS和ASP.NET的集成请求处理体系结构。 When a worker process in an application pool receives a request, the request passes through an ordered list of events. 当应用程序池中的工作进程接收到请求时,该请求将通过事件的有序列表。 Each event calls the necessary native and managed modules to process portions of the request and to generate the response. 每个事件都调用必要的本机和托管模块,以处理请求的各个部分并生成响应。

There are several benefits to running application pools in Integrated mode. 在集成模式下运行应用程序池有很多好处。 First the request-processing models of IIS and ASP.NET are integrated into a unified process model. 首先,将IIS和ASP.NET的请求处理模型集成到一个统一的流程模型中。 This model eliminates steps that were previously duplicated in IIS and ASP.NET, such as authentication. 此模型消除了先前在IIS和ASP.NET中重复的步骤,例如身份验证。 Additionally, Integrated mode enables the availability of managed features to all content types. 此外,集成模式使托管功能可用于所有内容类型。

Classic application pool mode 经典应用程序池模式

When an application pool is in Classic mode, IIS 7.0 handles requests as in IIS 6.0 worker process isolation mode. 当应用程序池处于经典模式时,IIS 7.0像在IIS 6.0工作进程隔离模式中一样处理请求。 ASP.NET requests first go through native processing steps in IIS and are then routed to Aspnet_isapi.dll for processing of managed code in the managed runtime. ASP.NET请求首先经过IIS中的本机处理步骤,然后被路由到Aspnet_isapi.dll,以在托管运行时中处理托管代码。 Finally, the request is routed back through IIS to send the response. 最后,该请求通过IIS路由回发送响应。

This separation of the IIS and ASP.NET request-processing models results in duplication of some processing steps, such as authentication and authorization. IIS和ASP.NET请求处理模型的这种分离导致某些处理步骤的重复,例如身份验证和授权。 Additionally, managed code features, such as forms authentication, are only available to ASP.NET applications or applications for which you have script mapped all requests to be handled by aspnet_isapi.dll. 此外,托管代码功能(例如表单身份验证)仅适用于ASP.NET应用程序或已对其脚本进行脚本映射的所有应用程序,这些请求均由aspnet_isapi.dll处理。

Be sure to test your existing applications for compatibility in Integrated mode before upgrading a production environment to IIS 7.0 and assigning applications to application pools in Integrated mode. 在将生产环境升级到IIS 7.0并将应用程序分配给集成模式下的应用程序池之前,请确保在集成模式下测试现有应用程序的兼容性。 You should only add an application to an application pool in Classic mode if the application fails to work in Integrated mode. 仅当应用程序无法在集成模式下工作时,才应将其添加到经典模式下的应用程序池中。 For example, your application might rely on an authentication token passed from IIS to the managed runtime, and, due to the new architecture in IIS 7.0, the process breaks your application. 例如,您的应用程序可能依赖于从IIS传递到托管运行时的身份验证令牌,并且由于IIS 7.0中的新体系结构,该过程破坏了您的应用程序。

Taken from: What is the difference between DefaultAppPool and Classic .NET AppPool in IIS7? 摘自: IIS7中的DefaultAppPool和Classic .NET AppPool有什么区别?

Original source: Introduction to IIS Architecture 原始资料: IIS体系结构简介

IIS 6.0 and previous versions : IIS 6.0和早期版本:

ASP.NET integrated with IIS via an ISAPI extension, a C API ( C Programming language based API ) and exposed its own application and request processing model. ASP.NET通过ISAPI扩展,C API(基于C编程语言的API)与IIS集成,并公开了自己的应用程序和请求处理模型。

This effectively exposed two separate server( request / response ) pipelines, one for native ISAPI filters and extension components, and another for managed application components. 这有效地公开了两个单独的服务器(请求/响应)管道,一个用于本机ISAPI筛选器和扩展组件,另一个用于托管应用程序组件。 ASP.NET components would execute entirely inside the ASP.NET ISAPI extension bubble AND ONLY for requests mapped to ASP.NET in the IIS script map configuration. ASP.NET分量将ASP.NET ISAPI扩展气泡内部, 并且仅在IIS脚本映射配置映射到ASP.NET请求完全执行。

Requests to non ASP.NET content types:- images, text files, HTML pages, and script-less ASP pages, were processed by IIS or other ISAPI extensions and were NOT visible to ASP.NET. 对非ASP.NET内容类型的请求:-图像,文本文件,HTML页面和无脚本的ASP页面,由IIS或其他ISAPI扩展处理,并且对ASP.NET不可见。

The major limitation of this model was that services provided by ASP.NET modules and custom ASP.NET application code were NOT available to non ASP.NET requests 此模型的主要限制是ASP.NET模块和自定义ASP.NET应用程序代码提供的服务不适用于非ASP.NET请求

What's a SCRIPT MAP ? 什么是脚本映射?

Script maps are used to associate file extensions with the ISAPI handler that executes when that file type is requested. 脚本映射用于将文件扩展名与在请求该文件类型时执行的ISAPI处理程序相关联。 The script map also has an optional setting that verifies that the physical file associated with the request exists before allowing the request to be processed 脚本映射还具有一个可选设置,该设置可在允许处理请求之前验证与请求关联的物理文件是否存在

A good example can be seen here 一个很好的例子可以在seen here

IIS 7 and above IIS 7及更高版本

IIS 7.0 and above have been re-engineered from the ground up to provide a brand new C++ API based ISAPI. IIS 7.0及更高版本已完全重新设计,以提供基于C ++ API的全新ISAPI。

IIS 7.0 and above integrates the ASP.NET runtime with the core functionality of the Web Server, providing a unified(single) request processing pipeline that is exposed to both native and managed components known as modules ( IHttpModules ) IIS 7.0及更高版本将ASP.NET运行时与Web服务器的核心功能集成在一起,提供了一个统一的(单个)请求处理管道,该管道暴露给称为模块(IHttpModules)的本机组件和托管组件。

What this means is that IIS 7 processes requests that arrive for any content type, with both NON ASP.NET Modules / native IIS modules and ASP.NET modules providing request processing in all stages This is the reason why NON ASP.NET content types (.html, static files ) can be handled by .NET modules. 这意味着IIS 7会处理任何内容类型的请求,同时NON ASP.NET Modules / native IIS modulesASP.NET modules都在所有阶段都提供请求处理。 这就是NON ASP.NET内容类型( .html,静态文件)可以由.NET模块处理。

  • You can build new managed modules ( IHttpModule ) that have the ability to execute for all application content, and provided an enhanced set of request processing services to your application. 您可以构建新的托管模块( IHttpModule ),这些模块可以针对所有应用程序内容执行,并为您的应用程序提供了一组增强的请求处理服务。
  • Add new managed Handlers ( IHttpHandler ) 添加新的托管处理程序( IHttpHandler

In classic mode IIS works h ISAPI extensions and ISAPI filters directly. 在经典模式下,IIS可以直接使用ISAPI扩展和ISAPI筛选器。 And uses two pipe lines , one for native code and other for managed code. 并且使用两条管道,一条用于本机代码,另一条用于托管代码。 You can simply say that in Classic mode IIS 7.x works just as IIS 6 and you dont get extra benefits out of IIS 7.x features. 您可以简单地说,在IIS 7的经典模式下,IIS 7.x的工作原理与IIS 6相同,并且您没有从IIS 7.x的功能中获得额外的好处。

In integrated mode IIS and ASP.Net are tightly coupled rather then depending on just two DLLs on Asp.net as in case of classic mode. 在集成模式下,IIS和ASP.Net紧密耦合,而不是像传统模式下那样仅依赖于Asp.net上的两个DLL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM