locked
Web.config transform not working RRS feed

  • Question

  • User1014139044 posted

    I've created a new web.config (named Web.Cloud.config ) to transform when publishing to the Azure.

    The transformation that I need is the tag <system.serviceModel> entirely.

    On the original web.config transform I have:

    <?xml version="1.0"?>
    <configuration>
    
      <connectionStrings>
        ...
      </connectionStrings>
    
      <appSettings>
        ...
      </appSettings>
    
      <system.web>
        <compilation debug="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5"/> 
        <customErrors mode="Off"/>
      </system.web>
    
      <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior>
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    
      <system.webServer>
        ...
      </system.webServer>
    
    </configuration>

    on the Web.Cloud.config I have

    <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
      
      <system.serviceModel xdt:Transform="Replace">
        <behaviors>
          <serviceBehaviors>
            <behavior name="...">
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="false"/>
              <serviceCredentials>
                <userNameAuthentication userNamePasswordValidationMode="..."
                  customUserNamePasswordValidatorType="..., ..."/>
              </serviceCredentials>
            </behavior>
          </serviceBehaviors>
        </behaviors>
    
        <bindings>
          <wsHttpBinding>
            <binding name="Binding1">
              <security mode="...">
                <message clientCredentialType="UserName"/>
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
    
        <services>
          <service behaviorConfiguration=".." name="...">
            <endpoint address="" binding="..."  bindingConfiguration="..." contract="..." />
          </service>
        </services>
    
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>
    </configuration>

    When I click on "Preview Transform" the transformation is executed correctly, the entirely <system.serviceModel> is replaced.

    After publishing, using the Cloud Configuration, the transformation its not executed...

    What can I be doing wrong?

    Tuesday, December 23, 2014 11:47 AM

All replies