我最近发现了Visual Studio 2010的Web部署工具中的web.config自动转换。
它运行良好,但我有一个似乎无法工作的场景。
假设我有以下根 Web.config
<services>
<service name="Service1">
<endpoint address="" binding="customBinding" bindingConfiguration="LargeBufferBinding"
contract="Service1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service name="Service2">
<endpoint address="" binding="customBinding" bindingConfiguration="LargeBufferBinding"
contract="Service2" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service name="Service3">
<endpoint address="" binding="customBinding" bindingConfiguration="LargeBufferBinding"
contract="Service3" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
对于我的 Web.Release.config,我想要所有具有 mexHttpBinding 绑定的端点节点即将被删除。
我在 Web.Release.config 中使用了以下内容:
<services>
<service>
<endpoint binding="mexHttpBinding" xdt:Locator="Match(binding)" xdt:Transform="Remove" />
</service>
</services>
但是,这只会删除 Service1 中的第一个匹配项,而不会删除后续匹配项。
我尝试了在端点和服务节点上定位节点的各种方法,但只有第一个匹配项被替换。
有没有办法获得所有<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
即将被删除 ?
Thanks.
我刚刚尝试过这个,使用RemoveAll而不是Remove似乎可以解决问题:
<services>
<service>
<endpoint binding="mexHttpBinding" xdt:Locator="Match(binding)" xdt:Transform="RemoveAll" />
</service>
</services>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)