C# web.release.config更改动态web服务url
我正在编辑用于生产的web.release.config文件。我想在发布后更改web.config文件。 我找到了如何通过正确使用web.release.config文件来更改web.config,但不是针对这个特定组件 动态Web服务的URL必须更改 在web.config中:C# web.release.config更改动态web服务url,c#,asp.net,web-config,release,publish,C#,Asp.net,Web Config,Release,Publish,我正在编辑用于生产的web.release.config文件。我想在发布后更改web.config文件。 我找到了如何通过正确使用web.release.config文件来更改web.config,但不是针对这个特定组件 动态Web服务的URL必须更改 在web.config中: <applicationSettings> <FooService.Properties.Settings> <setting name="FooServi
<applicationSettings>
<FooService.Properties.Settings>
<setting name="FooService_Student" serializeAs="String">
<value>http://testwebservices.foo.bar.nl/Student.asmx</value>
</setting>
<setting name="FooService_User" serializeAs="String">
<value>http://testwebservices.foo.bar.nl/User.asmx</value>
</setting>
</FooService.Properties.Settings>
</applicationSettings>
http://testwebservices.foo.bar.nl/Student.asmx
http://testwebservices.foo.bar.nl/User.asmx
现在,如何更改这两种设置中的
?我尝试了以下方法,但没有成功:
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<applicationSettings>
<FooService.Properties.Settings>
<setting name="FooService_Student" serializeAs="String" xdt:Transform="Replace">
<value>http://webservices.foo.bar.nl/Student.asmx</value>
</setting>
<setting name="FooService_User" serializeAs="String" xdt:Transform="Replace">
<value>http://webservices.foo.bar.nl/User.asmx</value>
</setting>
</FooService.Properties.Settings>
</applicationSettings>
</configuration>
http://webservices.foo.bar.nl/Student.asmx
http://webservices.foo.bar.nl/User.asmx
有人有这方面的经验吗
谢谢 如何添加一个
xdt:Locator=“Match(name)”
,这可能就是您查找要替换的确切节点所需要的 将xdt:Transform=“Replace”
添加到applicationSettings
标记中
<applicationSettings xdt:Transform="Replace">
<FooService.Properties.Settings>
<setting name="FooService_Student" serializeAs="String">
<value>http://webservices.foo.bar.nl/Student.asmx</value>
</setting>
<setting name="FooService_User" serializeAs="String">
<value>http://webservices.foo.bar.nl/User.asmx</value>
</setting>
</FooService.Properties.Settings>
http://webservices.foo.bar.nl/Student.asmx
http://webservices.foo.bar.nl/User.asmx
这应该与上述答案结合起来,以提供一种更一般(更正确)的解决问题的方法。谢谢分享,先生。