asp.net – 自定义部分的Web配置转换
发布时间:2020-12-16 04:16:03 所属栏目:asp.Net 来源:网络整理
导读:我的MVC 5应用程序中有许多不同的Web.config用于不同的环境 – 例如测试/生产 我有适当的网络转换来更改不同环境的值.例如,我的web.config文件中有以下应用程序设置: appSettingsadd key="DevDisplayPanel" value="true" //appSettings 然后在我的Web.Test.
我的MVC 5应用程序中有许多不同的Web.config用于不同的环境 – 例如测试/生产
我有适当的网络转换来更改不同环境的值.例如,我的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> 我的问题是 – 是否可以进行Web转换,以便Test和Prod看起来如下所示: 测试: <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> 解决方法
您可以尝试替换< serverList>的内容.标签.
测试: <myCustomSection> <serverList xdt:Transform="Replace"> <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 xdt:Transform="Replace"> <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> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – EF,UoW和Repository – 何时在WebForms中部署Un
- "<a href='../目录" +变量+ 
- asp.net – Json.Net IsoDateTimeConverter无效
- asp.net-mvc – 在MVC SignalR服务器和Windows服务SIgnalR客
- ASP.Net 3.5 / 4.0 CodeBehind还是CodeFile?
- 当空的asp.net时,ListView LayoutTemplate不显示
- asp.net-mvc – 如何为ASP.NET MVC编写自己的View引擎?
- 在ASP.net Webforms中,如何检测有人按下哪个文本框?
- asp.net-mvc – 我可以在MVC区域内部署javascript文件吗?
- asp.net-mvc-3 – MV3复选框的重复查询字符串值(true,false
推荐文章
站长推荐
- asp.net-mvc – 如何单元测试MSTest中的JsonResu
- asp.net – 如何使用IIS重定向URL中的额外正斜杠
- 使用ASP.net和VB.net(或C#)从XML文件编辑和删除数
- WinForms和ASP.NET自定义控件的通用代码
- asp.net – ‘txtName’未声明 由于其保护等级可
- asp.net – 如何在发布项目时交换连接字符串?
- 在ASP.NET MVC中公开资源字符串到JavaScript文件
- entity-framework – Entity Framework EntityTy
- asp.net-mvc – 如何为每个ActionLink指定默认区
- asp.net-mvc – 为什么使用ASP.NET MVC局部视图(
热点阅读