1

我有 web.base.config 的以下部分:

  <system.serviceModel>
    <client>
      <!--   Reporting Services -->
      <endpoint name="ReportExecutionEndpoint" address="http://~MACHINENAMEREPLACEMENTTOKEN~/ReportServer/ReportExecution2005.asmx" binding="basicHttpBinding" behaviorConfiguration="AuthenticatedBehavior" bindingConfiguration="ReportingServicesConfiguration" contract="ReportingWebService.ReportExecutionServiceSoap" />
      <!--   Custom Services    -->
      <endpoint name="Blah1Endpoint" address="net.tcp://~MACHINENAMEREPLACEMENTTOKEN~/DomainServices/blah1.svc" binding="netTcpBinding" behaviorConfiguration="AuthenticatedBehavior" bindingConfiguration="LargerMessagesConfiguration" contract="Fully.Qualified.IBlah1" />
      <endpoint name="Blah2Endpoint" address="net.tcp://~MACHINENAMEREPLACEMENTTOKEN~/DomainServices/blah2.svc" binding="netTcpBinding" behaviorConfiguration="AuthenticatedBehavior" bindingConfiguration="LargerMessagesConfiguration" contract="Fully.Qualified.IBlah2" />
      <endpoint name="Blah3Endpoint" address="net.tcp://~MACHINENAMEREPLACEMENTTOKEN~/DomainServices/blah3.svc" binding="netTcpBinding" behaviorConfiguration="AuthenticatedBehavior" bindingConfiguration="LargerMessagesConfiguration" contract="Fully.Qualified.IBlah3" />
    </client>
  </system.serviceModel>

我想<identity><dns /></identity>为所有CustomServices添加一个 in,但不是ReportingServices。为此,我有以下转换段:

  <system.serviceModel>
    <client>
      <endpoint xdt:Locator="Condition(contains(@address, 'net.tcp'))">
        <identity xdt:Transform="Insert">
          <dns value="~MACHINENAMEREPLACEMENTTOKEN~" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>

问题在于,这仅适用于第一个 CustomService而不是所有其他的(尽管它正确地跳过了ReportingServices)。如何更改此转换以使其到达我的所有CustomServices端点?

4

1 回答 1

1

插入转换的设计方式是供一次性使用的。因此,它将仅插入第一个匹配项。

在这种情况下,您的解决方法是为每个 net.tcp 端点创建一个插入转换。

如果您确实需要完成此操作,您可以创建自己的自定义转换,该转换可以插入多个匹配项。我在http://sedodream.com/2010/09/09/ExtendingXMLWebconfigConfigTransformation.aspx上写了关于如何做到这一点的博客 。

于 2013-02-15T02:05:56.580 回答