我的 MVC 5 应用程序中有许多不同的 Web.configs 用于不同的环境 - 例如测试/生产
我有适当的网络转换来更改不同环境的值。例如,我的 web.config 文件中有以下应用程序设置:
<appSettings>
<add key="DevDisplayPanel" value="true" />
</appSettings>
然后在我的 Web.Test.config 和 Web.Prod.config 中使用 Web 转换来更改值,如下所示:
<appSettings>
<add key="DevDisplayPanel"
xdt:Transform="Replace"
xdt:Locator="Match(key)"
value="false" />
<appSettings>
然而,在我的 Web.config 中,我也有自己的自定义部分,该部分位于<appSettings>
部分如下:
<myCustomSection>
<serverList>
<add zone="Zone1" url="https://dev-myurl1.com"/>
<add zone="Zone2" url="https://dev-myurl2.com"/>
<add zone="Zone2" url="https://dev-myurl3.com"/>
</serverList>
</myCustomSection>
我的问题是 - 是否可以进行网络转换,以便测试和生产如下所示:
Test:
<myCustomSection>
<serverList>
<add zone="Zone1" url="https://test-myurl1.com"/>
<add zone="Zone2" url="https://test-myurl2.com"/>
<add zone="Zone2" url="https://test-myurl3.com"/>
</serverList>
</myCustomSection>
Prod:
<myCustomSection>
<serverList>
<add zone="Zone1" url="https://prod-myurl1.com"/>
<add zone="Zone2" url="https://prod-myurl2.com"/>
<add zone="Zone2" url="https://prod-myurl3.com"/>
</serverList>
</myCustomSection>