为web.config文件的部分单独的配置文件 [英] Separate config file for sections of web.config
问题描述
是否有可能有web.config中的特定部分单独的配置文件?具体来说,我想移动IIS 7的重写部分出在web.config中和到它自己的配置文件。
您当然可以将您的重写规则和映射到一个单独的文件:
在一个单独的文件存储URL重写映射
块引用>< system.webServer>
<&改写GT;
< rewriteMaps configSource =rewritemaps.config/>
<规则configSource =rewriteRules.config/>
< /重写>
< /system.webServer>此外,您可以移动了不少配置部分,以便他们自己的文件:
<的appSettings configSource =appSettings.config/>
<$c$c>[Docs]$c$c>
&LT;是connectionStrings configSource =connectionStrings.config/&GT;
<$c$c>[Docs]$c$c>
&LT;页面configSource =pages.config/&GT;
<$c$c>[Docs]$c$c>
块引用>有关详细信息请参阅本页面,这将帮助您决定是否配置节可以存储在外部:
块引用>Is it possible to have separate config files for specific sections of the web.config? Specifically I'd like to move IIS 7's rewrite section out of the web.config and into it's own config file.
解决方案You can certainly move your rewrite rules and mappings out to a separate file:
<system.webServer> <rewrite> <rewriteMaps configSource="rewritemaps.config" /> <rules configSource="rewriteRules.config" /> </rewrite> </system.webServer>
In addition you can move quite a few configuration sections to their own files:
<appSettings configSource="appSettings.config" />
[Docs]
<connectionStrings configSource="connectionStrings.config"/>
[Docs]
<pages configSource="pages.config"/>
[Docs]
For more info see this page which will help you decide if a configuration section can be stored externally:
这篇关于为web.config文件的部分单独的配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!