是否可以为web.config的特定部分分别配置文件?具体来说,我想将IIS 7的重写部分移出web.config并进入它自己的配置文件.
Kev*_*Kev 41
您当然可以将重写规则和映射移到单独的文件中:
<system.webServer>
<rewrite>
<rewriteMaps configSource="rewritemaps.config" />
<rules configSource="rewriteRules.config" />
</rewrite>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
此外,您可以将相当多的配置部分移动到自己的文件中:
<appSettings configSource="appSettings.config" />[Docs]
<connectionStrings configSource="connectionStrings.config"/>[Docs]
<pages configSource="pages.config"/>[Docs]
有关详细信息,请参阅此页面,该页面将帮助您确定是否可以在外部存储配置部分:
Ode*_*ded 19
是的,这是可能的.
对于每个配置节,您可以将configSource属性设置为您保存配置的位置(文件).
例如:
<appSettings configSource="appSettings.config" />
Run Code Online (Sandbox Code Playgroud)
在appSettings.config中:
<?xml version="1.0" encoding="UTF-8"?>
<appSettings>
<add key="myKey" value="myValue" />
</appSettings>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20373 次 |
| 最近记录: |