我在ASP.net web.config上有一个关于企业库日志记录块的部分。是否可以将日志记录配置分成另一个配置文件?我该怎么做?
答案 0 :(得分:2)
是的,有可能 - 事实上,每个应用程序块的单独配置文件是Enterprise Library 1.0工作的唯一方式。
查看David Hayden的this blog post - 他展示了如何在单独的文件中为每个应用程序块设置配置。
答案 1 :(得分:2)
Web.config中的任何部分都可以在Web.config之外生存。只需添加configSource attribute并指定文件名即可。以下是我们为一个项目所做的一个例子。
<configuration>
<configSection>
<section name="microMvc" type="MicroMvc.MvcSection" allowDefinition="MachineToApplication" restartOnExternalChanges="true" />
</configSection>
<microMvc configSource="micromvc.config" />
</configuration>