Jack
Jack

Reputation: 10037

Separate configuration file for MS Enterprise Library

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?

Upvotes: 2

Views: 1477

Answers (2)

Brig Lamoreaux
Brig Lamoreaux

Reputation:

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>

Upvotes: 2

Guy Starbuck
Guy Starbuck

Reputation: 21873

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.

Upvotes: 2

Related Questions