加入收藏 | 设为首页 | 会员中心 | 我要投稿 辽源站长网 (https://www.0437zz.com/)- 云专线、云连接、智能数据、边缘计算、数据安全!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

web-config – Web.config转换:如何将转换应用于与Locator表达

发布时间:2020-12-31 10:19:34 所属栏目:资源 来源:网络整理
导读:我最近在visual studio 2010的web部署工具中发现了web.config自动转换. 它运作良好,但我有一个我似乎无法工作的场景. 假设我有以下根Web.config services service name="Service1" endpoint address="" binding="customBinding" bindingConfiguration="Large

我最近在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>

(编辑:辽源站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读