Click here to Skip to main content
12,953,865 members (52,222 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

5.5K views
2 bookmarked
Posted 31 Mar 2014

New Features in WCF 4.5 - Part 1

, 31 Mar 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
New features in WCF 4.5 - Part 1

Windows Communication Foundation v 4.5 released with lots of new features and we have already highlighted those features in previous WCF Tutorial. Now, we wanted to dive deeper and explore each new feature in more detail. Here in this WCF Tutorial - Part 1, we are going to discuss the following two new features in more details:

  • Simplified Generated Config Files
  • Validating WCF Configuration

WCF - Simplified Generated Config Files

Windows Communication Foundation has been an amazing programming platform for building service-oriented applications since its birth. However, if you visit WCF online forums and communities, you will find out that most of the WCF developers had a concern that it has lengthy and complex configuration settings.
If you ever worked with previous versions of WCF, you must be familiar with the following configuration.

<System.serviceModel>
<bindings>
<wsHttpBinding>
            <binding name="WSBinding" 

            closeTimeout="00:01:00" openTimeout="00:01:00"

                receiveTimeout="00:10:00" 

                sendTimeout="00:01:00" bypassProxyOnLocal="false"

                transactionFlow="false" 

                hostNameComparisonMode="StrongWildcard"

                maxBufferPoolSize="524288" 

                maxReceivedMessageSize="65536"

                messageEncoding="Text" 

                textEncoding="utf-8" useDefaultWebProxy="true"

                allowCookies="false">
                <readerQuotas maxDepth="32" 

                maxStringContentLength="8192" maxArrayLength="16384"

                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00"

                    enabled="false" />
                <security mode="Message">
                  <transport clientCredentialType="Windows" 

                  proxyCredentialType="None"

                     realm="">
                       <extendedProtectionPolicy policyEnforcement="Never" />
                    </transport>
                    <message clientCredentialType="Windows" 

                    negotiateServiceCredential="true"

                        algorithmSuite="Default" 

                        establishSecurityContext="true" />
                </security>
            </binding>
        </wsHttpBinding>
</bidnings>
<client>
<endpoint name="WSBinding"

 address="http://localhost/MyFirstWebService/TestService.svc"

 binding="wsHttpBinding"

 bindingConfiguration="WSHttpBinding_ITestService"

 contract="ITestService" />
</client>
</System.serviceModel>

The above configuration is the default binding configuration generated on client-side when you add a service reference, because all previous versions of WCF generate default settings that makes it lengthy as well as complex. Default binding configuration is shown in blue text above.

In WCF 4.5, the generated configuration will only have non-default binding configuration as follows:

<System.serviceModel>
<bindings>
<wsHttpBinding>
            
        </wsHttpBinding>
</bidnings>
<client>
<endpoint name="WSBinding"

  address="http://localhost/MyFirstWebService/TestService.svc"

  binding="wsHttpBinding"

  bindingConfiguration="WSHttpBinding_ITestService"

  contract="ITestService" />
</client>
</System.serviceModel>

Now, the generated configuration file is pretty much simplified.

WCF - Validating WCF Configuration

Validating configuration is another amazing features in Windows Communication Foundation v4.5. Basically, it can be considered as an enhancement to Visual Studio as well. Previously, config files were not validated if we build our WCF project.

Now with WCF 4.5, if we build our project and our configuration file has some validation issue, Visual Studio will alert us by displaying such validation errors as warnings.

Consider the following invalid config settings, a warning will be displayed that "Expecting end tag </service>":

<service name="MyTestService" /> 

In this post, we discussed in detail about two new features in version 4.5, those are related to WCF configuration. In later WCF Tutorials, hopefully, we will explore more new features.

Other Related Tutorials

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Imran Abdul Ghani
Software Developer (Senior) Emaratech
United Arab Emirates United Arab Emirates
Imran Abdul Ghani has more than 10 years of experience in designing/developing enterprise level applications. He is Microsoft Certified Solution Developer for .NET(MCSD.NET) since 2005. You can reach his blogging at WCF Tutorials, Web Development, SharePoint for Dummies.

You may also be interested in...

Comments and Discussions

 
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170525.1 | Last Updated 1 Apr 2014
Article Copyright 2014 by Imran Abdul Ghani
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid