使用XML Transformation更改我的web.config中的服务端点地址

时间:2018-11-20 17:58:32

标签: xml visual-studio xslt transformation

我有两个与服务关联的终结点地址,并且我想在Web.Release.config中更改它们。我以前没有处理过XML转换,所以我不确定该怎么做,特别是在有多个端点地址需要更改的情况下。

我在Stackoverflow上找到了其他示例,但是这些示例的XML结构与我的不同。

  render(){
    return (
      <div className="note">
        <Route to='/edit/:id' render={(props) =>
          <div>
            <NoteList {...props} />
            <EditNotePage {...props} />
          </div>
        } />
      </div>
    )
  }

我需要更改两个端点地址 https://MyApp.net/Documents.svc https://MyApp.net/Leads.svc

1 个答案:

答案 0 :(得分:0)

我知道了。这是我想出的转变。

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

    <system.serviceModel>

        <services>

            <service name="MyService.Documents">
                <endpoint name="MyService.Documents.Endpoint" 
                    address="https://MyApp-sandbox.net/Documents.svc"
                    xdt:Locator="Match(name)"
                    xdt:Transform="SetAttributes(address)"/>
            </service>

            <service name="MyService.Leads">
                <endpoint name="MyService.Leads.Endpoint"
                    address="https://MyApp-sandbox.net/Leads.svc"
                    xdt:Locator="Match(name)"
                    xdt:Transform="SetAttributes(address)"/>
            </service>

        </services>

    </system.serviceModel>

</configuration>