web-config C Web.config转换如何将转换应用于与Locator表达
发布时间:2024-06-09 12:02:08 所属栏目:资源 来源:DaWei
导读: 我最近在visual studio 2010的web部署工具中发现了web.config自动转换.
它运作良好,但我有一个我似乎无法工作的场景.
假设我有以下根Web.config
<services>
<service nam
它运作良好,但我有一个我似乎无法工作的场景.
假设我有以下根Web.config
<services>
<service nam
我最近在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”/>即将被删除 ? 谢谢. 解决方法 我刚试过这个并使用RemoveAll而不是Remove似乎可以解决这个问题: <services> <service> <endpoint binding="mexHttpBinding" xdt:Locator="Match(binding)" xdt:Transform="RemoveAll" /> </service> </services> (编辑:拼字网 - 核心网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |