207

每次我必须使用 IIS7 为 ASP.NET 添加处理程序或模块时,说明总是告诉我将其合并为两个部分:system.websystem.webserver.

<system.web>
    <httpHandlers>
    </httpHandlers>
    <httpModules>
    </httpModules>
</system.web>

和这个:

<system.webServer>
    <modules>
    </modules>
    <handlers>
    </handlers>
</system.webServer>

这两个部分有什么区别?

此外,如果我不将其添加到该system.web部分,我的 Visual Studio 2008 调试器也无法正常工作。

4

2 回答 2

163

The system.web section is for configuring IIS 6.0, while the system.webserver version is used to configure IIS 7.0. IIS 7.0 includes a new ASP.NET pipeline and some configuration differences, hence the extra config sections.

However...

If you're running IIS 7.0 in integrated mode only, you shouldn't need to add the handlers to both sections. Adding it to system.web as well is a fallback for IIS 7.0 operating in classic mode, unless I'm mistaken. I've not done extensive testing on this.

See http://msdn.microsoft.com/en-us/library/bb763179.aspx for more information.

于 2008-12-10T06:59:25.550 回答
46

The former is for Classic Mode.

The latter is for Integrated Pipeline Mode (available in IIS7+).

于 2008-12-10T06:59:42.010 回答