문제

I've recently discovered the web.config automatic transformation in the web deploy tool of visual studio 2010. It's working well, but I have a scenario I can't seem to get working. Assume I have the following root 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>

For my Web.Release.config, I want all the endpoint nodes with a binding of mexHttpBinding to be removed.

I've used the following in my Web.Release.config:

<services>
  <service>
    <endpoint binding="mexHttpBinding" xdt:Locator="Match(binding)" xdt:Transform="Remove" />
  </service>
</services>

However, this will only remove the first match, in the Service1, but not the following ones. I've tried various way of locating the node, on the endpoint and service node, but only the first match ever gets replaced.

Is there a way to get all the <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> to be removed ?

Thanks.

도움이 되었습니까?

해결책

I've just tried this and using RemoveAll instead of Remove seems to do the trick:

<services>
  <service>
    <endpoint binding="mexHttpBinding" xdt:Locator="Match(binding)" xdt:Transform="RemoveAll" />
  </service>
</services>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top