For the system.web/httpHandlers section of web.config I can use the "configSource" attribute to specify an external configuration file, like so:
<system.web>
<httpHandlers configSource="App_Config\httpHandlers_iis6.config" />
</system.web>
This allows me to use the same set of handlers across all of my environments while only having to maintain them in one place, while still allowing things like appSettings to change from one web.config to the next.
Unfortunately, it appears that the same technique is not supported for t开发者_高级运维he section pertaining to IIS7 handlers:
<system.webServer>
<handlers configSource="App_Config\httpHandlers_iis7.config" /> <!-- not supported -->
</system.webServer>
Is there any way to separate my handlers configuration from the main web.config file for IIS7?
Ah - I've got it.
Here's my line from the web.config:
<handlers configSource="App_Config\Handlers.xml" />
not the \ rather than the / (I got caught there)
and in my external file I've got:
<handlers accessPolicy="Read, Write, Script, Execute">
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
...
...
...
<add verb="GET,HEAD,POST" preCondition="integratedMode" name="SpellChecker" path="GoogleSpellChecker.ashx" type="umbraco
.presentation.umbraco_client.tinymce3.plugins.spellchecker.GoogleSpellChecker,umbraco"/>
<add verb="POST,GET,HEAD" name="Elmah" path="/umbraco/elmah.axd" type="Westfield.Web.Application.SecureErrorLogPageFactory, Westfield.Web"/>
</handlers>
And it worked :)
Hope this helps someone.
精彩评论