209

Every time I have to add a handler or module for ASP.NET with IIS7, the instructions always tell me to incorporate it into two sections: system.web and system.webserver.

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

And this:

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

What is the difference between these two sections?

In addition, if I don't add it to the system.web section, my Visual Studio 2008 debugger also doesn't work correctly.

DavidRR
  • 18,291
  • 25
  • 109
  • 191
danmine
  • 11,325
  • 17
  • 55
  • 75
  • 2
    a better current reference for this is: http://msdn.microsoft.com/en-us/library/46c5ddfy.aspx – Shannon Jun 06 '10 at 17:53

2 Answers2

164

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.

Chris
  • 27,596
  • 25
  • 124
  • 225
  • 4
    What about attributs like which are placed in system.web but still make a difference on IIS 7 Integrated mode? – sclarson Jul 08 '11 at 15:00
  • 42
    The system.web section isn't superseded by the system.webserver section, just extended. – Chris Jul 08 '11 at 16:17
  • On IIS 8.5 I've found that the `httpCookies` setting is not available in system.webServer but works if I create a system.web and put it in there. – Eborbob Nov 23 '17 at 09:37
46

The former is for Classic Mode.

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

leppie
  • 115,091
  • 17
  • 196
  • 297
  • Given my experience, is this is a better answer in length, clarity and reality. In addition to classic mode on the former, add IIS express and other servers that are not IIS 7. – Ben Gripka Mar 28 '15 at 23:29