2016-03-21 9 views
0

Web.config originalWeb Config Transformation für behaviorConfiguration Attribut funktioniert nicht

<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> 

Was ich

<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> 

sein wollen Das ist das, was ich schon versucht:

<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> 

Die Original-Web-Konfiguration ändert sich überhaupt nicht.

Im ursprünglichen Web-Cofig gibt es mehrere Service-Blöcke mit unterschiedlichen Namen. Ich darf keine Änderungen an der ursprünglichen Konfigurationsdatei vornehmen. Gibt es eine Möglichkeit, dies zu tun, ohne die Originaldatei zu berühren?

+0

Verwenden Sie den Release Management Server oder das neue webbasierte Release Management? –

+0

Erstellen Sie außerdem Ihre Anwendung mit den entsprechenden MSBuild-Flags, um Konfigurationsumwandlungen aufzurufen? –

+0

Ich benutze Release-Management-Server, aber ich denke nicht, RM ist hier ein Problem. Ich habe andere Konfigurationsumwandlung in meiner Akte und sie arbeiten alle wie erwartet. Nur dieser funktioniert nicht. –

Antwort

0

Ich habe es funktioniert, indem Sie das gesamte "Services" -Element ersetzen.

<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>