Wednesday, August 11, 2010

WCF 4–New Feature–Default Configuration

Until recently I had worked only with WCF upto version 3.5. So recently when I came across a configuration file which only had this information in it, I was perplexed to say the very least:

<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>


What was missing from the web.config file were the endpoint and behavior definitions. But the service worked correctly. Very perplexing indeed.

And then I found out that in WCF4, the .Net team added a new feature called default configuration. The goal of default configuration was to make it easy to create a basic web-service (as easy as it was to create a web-service using the ASMX file – a .Net 2.0). Which is why the above configuration section doesn’t have any settings for endpoints or behaviors – they are being setup by default configuration.

For more information about Default Configuration read:

MSDN: A Developer's Introduction to Windows Communication Foundation 4

Code-Magazine: New Features in WCF 4 that Will Instantly Make You More Productive

No comments: