我有两个与我的服务相关联的端点地址,我想在我的Web.Release.config中更改这两个端点地址。我以前没有使用过XML转换,所以我不确定如何做到这一点,特别是在需要更改多个端点地址的情况下。
我在Stackoverflow上找到了其他示例,但这些示例的XML结构与我的不同。
</configuration>
<system.serviceModel>
<services>
<service behaviorConfiguration="MyService.ServiceBehavior" name="MyService.Documents">
<endpoint name="MyService.Documents.Endpoint"
address="https://MyApp.net/Documents.svc"
behaviorConfiguration="MyService.EndpointBehavior"
binding="webHttpBinding"
bindingConfiguration="TransportSecurity"
contract="MyService.IDocuments" />
</service>
<service behaviorConfiguration="MyService.ServiceBehavior" name="MyService.Leads">
<endpoint name="MyService.Leads.Endpoint"
address="https://MyApp.net/Leads.svc"
behaviorConfiguration="MyService.EndpointBehavior"
binding="webHttpBinding"
bindingConfiguration="TransportSecurity"
contract="MyService.ILeads" />
</service>
</services>
</system.serviceModel>
</configuration>两个端点地址https://MyApp.net/Documents.svc和https://MyApp.net/Leads.svc是我需要更改的。
发布于 2018-11-21 18:52:32
我想通了。这是我想出的转变。
<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>https://stackoverflow.com/questions/53398861
复制相似问题