Most often when you create WCF webservices you'll want to run them in a secure channel, for instance by using SSL encryption on the transport level. This makes it however cumbersome during development, when you want to host the service on your local development server.Consequently, when testing locally you'd set the transport mode to "None" while during deploy you'd change it to "Transport" security (or one of the desired alternatives). You need to remember to change the service's configuration in the web.config however and we all know that it is easy to forget these things, not to mention our laziness ;).
Visual Studio 2010 has now a new feature called "Web.config Transformations". It allows you to manipulate your default web.config settings similar as in XSL transformations. The available transformations are limited to the assembly compilation options, "Debug" and "Release" mode.
This comes in really handy when trying to automate the above mentioned scenario. The default web.config settings should fit those for local development.
<system.serviceModel>When publishing using release compilation, the following transformations would be applied
<service behaviorConfiguration="myService_v1Behavior" name="MyCompany.MyProject.WSService.MyService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="MyService_v1_0_SOAP11Binding" contract="MyCompany.MyProject.WSService.MyService_v1_0">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<serviceMetadata httpGetEnabled="true" externalMetadataLocation="../wsdl/MyService_v1.wsdl"/>
<?xml version="1.0"?>As can be seen, the security mode part is being replaced, activating Transport security.
<compilation xdt:Transform="RemoveAttributes(debug)" />
<binding name="MyService_v1_0_SOAP11Binding" xdt:Transform="Replace">
<!-- snip snip -->
<!-- snip snip -->
Now obviously, this is a very dummy file I just copy&pasted from a project, taking out irrelevant parts. But if you get the idea, you see how powerful these transformations can be.