Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# web.release.config更改动态web服务url_C#_Asp.net_Web Config_Release_Publish - Fatal编程技术网

C# web.release.config更改动态web服务url

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

我正在编辑用于生产的web.release.config文件。我想在发布后更改web.config文件。 我找到了如何通过正确使用web.release.config文件来更改web.config,但不是针对这个特定组件

动态Web服务的URL必须更改

在web.config中:

<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   

这应该与上述答案结合起来,以提供一种更一般(更正确)的解决问题的方法。谢谢分享,先生。