web.release.config 更改动态 Web 服务 url

发布于 2024-09-28 10:13:20 字数 1563 浏览 2 评论 0原文

我正在编辑 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>

现在,如何更改这两个设置中的 ?我尝试了以下方法,但没有成功:

<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>

有人遇到过这件事吗?

谢谢你!

I'm editing my web.release.config file for production. I want the web.config file changed after a publish.
I found how to change the web.config by using the web.release.config file properly, but not for this particular component.

The URL of an dynamic webservice has to change.

In the 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>

now, how do I change the <value> in both settings? I tried the following, but that didn't work out:

<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>

Anyone experience with this matter?

Thankyou!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心在旅行 2024-10-05 10:13:20

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>   

Add xdt:Transform="Replace" to the applicationSettings tag.

<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>   

不语却知心 2024-10-05 10:13:20

添加一个 xdt:Locator="Match(name)" 怎么样,这可能就是您找到要替换的确切节点所需要的。

How about adding a xdt:Locator="Match(name)", that will probably be what you need to find the exact nodes to replace.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文