Pergunta

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.

Foi útil?

Solução

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>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top