Web.config original
<service behaviorConfiguration="Test.DevelopmentPc.Environment.Behavior" name="Tks.Licensing.Service.ActivationServer">
<endpoint address="" name="httpEndpoint" binding="basicHttpBinding" bindingConfiguration="testBasicHttpBinding" contract="Tks.Licensing.Contracts.ServiceContract.IActivationService"/>
<endpoint address="mex" binding="mexHttpBinding" name="mexEndpoint" contract="IMetadataExchange"/>
</service>
What I want it to be
<service behaviorConfiguration="__BehaviorConfiguration__" name="Tks.Licensing.Service.ActivationServer">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="secureWsHttpBinding" name="httpEndpoint" contract="Tks.Licensing.Contracts.ServiceContract.IActivationService">
<identity>
<dns value="__ServerIdentity__"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" name="mexEndpoint" contract="IMetadataExchange" />
</service>
This is what I tried already:
<service behaviorConfiguration="__BehaviorConfiguration__" name="Tks.Licensing.Service.ActivationServer" xdt:Transform="SetAttributes(behaviorConfiguration)" xdt:Locator="Match(name)">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="secureWsHttpBinding" name="httpEndpoint" contract="Tks.Licensing.Contracts.ServiceContract.IActivationService">
<identity xdt:Trasform="Insert">
<dns value="__ServerIdentity__"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" name="mexEndpoint" contract="IMetadataExchange" />
</service>
The original web config is not changing at all.
There are several service blocks in the original web cofig with different names. I am not allowed to make any changes to the original config file. Is there a way to do it without touching the original file?
I got it working by replacing the whole "services" element.
<services xdt:Transform="Replace">
<service behaviorConfiguration="__BehaviorConfiguration__" name="Tks.Licensing.Service.ActivationServer">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="secureWsHttpBinding" name="httpEndpoint" contract="Tks.Licensing.Contracts.ServiceContract.IActivationService">
<identity>
<dns value="__ServerIdentity__"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" name="mexEndpoint" contract="IMetadataExchange" />
</service></services>