1

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 the 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?

1
  • I'd like to know this too. although reason is a little different. I want one section for IIS7.5 on 64bit, and one for IIS7.5 32bit. Commented Dec 2, 2010 at 4:51

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

5 Comments

What you describe does not work for me. The system.webServer/handlers element does not support the "configSource" attribute.
Hi David. In my Web.config VS2010 underlines the configsource attribute saying it doesn't recognise it, but I can assure you it worked for me. I'd like to re-iterate, make sure you use a backslash, rather than a forward slash (that got me).
So I ignored it when it told me it doesn't recognise the attribute
Well I'll be damned, you're right! I could swear I tried this exact setup before, but I must have made a mistake the first time. Thanks!
The runtime section happily accepts the configSource attribute but it does not read the external file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.