迁移到iis7

      近期部门系统全部从xp升级到win7,iis直接从5.x到7.x,本地部署着一个从2005发展来的web应用,最关心的是iis7较之前版本有什么不同,配置需要做哪些更改。以前停留在瞄了几眼的iis7该花些时间仔细看看了。以下主要参考自Moving an ASP.NET Application from IIS 6.0 to IIS 7.0(http://msdn.microsoft.com/en-us/library/bb515251.aspx。)

简介:

iis web 应用有两种模式:classic和integrated。

classic向后兼容早起iis版本,既是沿用之前以ISAPA扩展的模式调用asp.net。早期版本使用classic模式,基本不用更改任何配置和程序。

integrated模式中,asp.net请求处理管道直接集成进iis核心请求管道,不再作为一种ISAPA扩展,这样asp.net可以看见所有的请求,包括静态文件。这是iis7和早前版本最大的不同,也是一个跨越性的提升。这样带来的好处有:性能,可控性更好的配置功能,更方便的使用托管代买创建iis扩展。迁移到使用integrated模式,可能要更改web.config,假如之前使用了IHttpModule和Handler那是必须要改的。因为父节点都变了。项目中使用了structmap作为Ioc工具,都受到了影响,必须更高cs代码。

除了 .NET Framework version 1.1,其他版本的asp.net应用,这两种模式都支持。1.1只能使用classic。

一些iis7上,web.cong的不同处:主要多了个 system.webServer节点。

Element

Description

asp

Optional element.

Configures settings for Active Server Pages (ASP) applications.

caching

Optional element.

Configures output cache settings.

cgi

Optional element.

Configures default settings for Common Gateway Interface (CGI) applications.

defaultDocument

Optional element.

Configures settings for returning a default document to a client browser when the client does not specify a file name in a request.

directoryBrowse

Optional element.

Configures whether directory browsing is enabled or disabled on the Web server, and specifies the information to include in a directory listing.

fastCgi

Optional element.

Contains a collection of fastCgi application pool definitions.

globalModules

Optional element.

Specifies configuration settings for global modules on a Web server.

handlers

Optional element.

Specifies handlers to process requests made to sites and applications.

httpCompression

Optional element.

Configures HTTP compression settings for a Web server.

httpErrors

Optional element.

Configures HTTP error messages for a Web server.

httpLogging

Optional element.

Specifies configuration settings for HTTP.sys logging.

httpProtocol

Optional element.

Configures custom and redirect response headers to be sent from the server to the client.

httpRedirect

Optional element.

Configures settings for redirecting client requests to a new location.

httpTracing

Optional element.

Specifies configuration settings for HTTP.sys tracing.

isapiFilters

Optional element.

Specifies configuration settings for ISAPI filters on a Web server.

management

Optional element.

Configures a Web server for remote management by using IIS Manager.

modules

Optional element.

Specifies configuration settings for modules on a Web server.

odbcLogging

Optional element.

Configures Open Database Connectivity (ODBC) logging.

security

Optional element.

Specifies the section group that contains security-related sections.

serverRuntime

Optional element.

Configures request limits for applications on a Web server.

serverSideIncludes

Optional element.

Specifies whether server-side includes (SSI) #exec directives are disabled.

staticContent

Optional element.

Configures static file request handler settings.

tracing

Optional element.

Configures request trace settings.

urlCompression

Optional element.

Configures compression of static and dynamic content.

validation

Optional element.

Configures IIS 7.0 to detect whether an ASP.NET application that is set up to run in ISAPI mode needs any migration in order to function correctly in Integrated mode.

webdav

Optional Element.

Configures Web Distributed Authoring and Versioning (WebDAV) for Internet Information Services (IIS) 7.

注意到Modules 和Handlers 使我们经常需要用到的节点。

如何迁移到integrated

所需的工作不是很多,大概一下几步:

1,  注册modules和handlers到 system.webServer

2,  定义一些handler处理httapplication请求管道上的一些事件,比如BeginRequest 和 EndRequest.

其他一些新增功能

假如是使用integrated和.net framework3.0或以上版本,那么可以使用以下功能:

原文地址:https://www.cnblogs.com/wusong/p/2634162.html