views:

493

answers:

2

I have a section on my ASP.net web.config for the Enterprise library logging block. Is it possible to separate the logging configuration into another configuration file? How do I do that?

+2  A: 

Yes, it is possible -- in fact, separate config files for each app block was the only way that Enterprise Library 1.0 worked.

Check out this blog post from David Hayden -- he shows how to set up the configs for each application block in separate files.

Guy Starbuck
+1  A: 

Any section in the Web.config can live outside of the Web.config. Just add a configSource attribute and specify the filename. Here is an example of what we did for one project.

<configuration>
  <configSection>
    <section name="microMvc" type="MicroMvc.MvcSection" allowDefinition="MachineToApplication" restartOnExternalChanges="true" />
  </configSection>
  <microMvc configSource="micromvc.config" />
</configuration>