Asked by:
Web.config transform not working

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
-
User103933760 posted
Hi,
About How to Transform Web.config When Deploying a Web Application Project:
http://msdn.microsoft.com/en-us/library/vstudio/dd465318(v=vs.100).aspx
http://msdn.microsoft.com/en-us/library/dd465326(v=vs.110).aspx
Wednesday, December 24, 2014 3:22 AM -
User1014139044 posted
I've already read those instructions and I've followed them... But, if you could read my post carefully, the "Preview Transform" is correct, the actual tranform is not...
Friday, December 26, 2014 6:24 AM -
User-74816725 posted
I've got the same exact problem with a distributed web.config. I.e. the transform preview is correct. Did you get this resolved.
Thanks!
Wednesday, April 15, 2015 9:10 AM