Iis – Is there way to tell IIS7 Manager modify handlers in applicationHost.config

configurationiisiis-7iis-7.5

Whenever I add a Handler Mapping for a website in IIS7 Manager it always adds the handler to the site's local web.config file.

Is there a way to tell the manager to only add the handler mapping to the site configuration in applicationHost.config, for example:

<location path="Test Site">
    <system.webServer>
        <handlers>
            <clear />
            <add 
                name="PHP-FastCGI" 
                path="*.php" verb="GET,HEAD,POST" 
                modules="FastCgiModule" 
                scriptProcessor="c:\php\php-cgi.exe" 
                resourceType="Either" 
            />
            <-- Other handler mappings here -->
        </handlers>
        <security>
            <authentication>
                <anonymousAuthentication 
                    enabled="true" 
                    userName="i_test" 
                    password="[enc:AesProvider:snipped:enc]" 
                />
            </authentication>
        </security>
    </system.webServer>
</location>

I know how to do this using appcmd using the /commit:apphost switch but it'd be nice to achieve this via the UI.

Best Answer

IIS Manager purposefully sets the setting at the lowest level that is allowed. Since you're allowed to have that set in the site's web.config, it will always apply it there.

IIS Manager itself does not give you a choice where to set it. The reason is that it would quickly become confusing and messy for the average administrator since a setting in applicationHost.config would be ignored if it's also set in web.config. So the cleanest way to ensure that there isn't confusion is to apply it at the lowest level allowed.

The solution (besides appcmd or editing applicationHost.config directly) is to use Configuration Editor from the IIS Admin pack (it's installed by default with IIS 7.5 on WS08 R2). That does allow you to choose where you want settings to be applied.

Actually, to be complete, although usually not a worthwhile option for handlers, you can turn off delegation for handlers for that site or the server. Then IIS Manager will set it in applicationHost.config.