Monday, December 21, 2015

Features of Windows Communication Foundation v4.5 part 3:

Simplified Generated Configuration:
As simplified config files were introduced that had the concepts of default bindings and default endpoints - meaning that you could create an out-of-the-box WCF service application in 4.0 or 4.5 and there would be no binding or endpoint defined - you can verify this by looking at the web.config files for your 4.0 and 4.5 service.

When you add a service reference, you most likely used an "http://" URI - by default, "http" maps to basicHttpBinding. So let's look at the snippet you posted in the comments:
<endpoint address="localhost:36275/Service1.svc"
           binding="basicHttpBinding" 
           bindingConfiguration="BasicHttpBinding_IService1"
           contract="ServiceReference1.IService1" 
           name="BasicHttpBinding_IService1" />
Everything the client needs to communicate with the service is there - the address, the binding to use, the binding configuration to use and the contract.
If you look in the client config file, you should see the following as well:
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IService1" />
  </basicHttpBinding>
</bindings>
Which corresponds to the binding specified by the endpoint's bindingConfiguration attribute. Since the defaults are being used, the other properties for the binding are not specified.
In 3.0 and 3.5, the binding section would have had all the properties of the binding specified with default values - in 4.0 and later it does not.
You're not missing anything - other than the documentation being a little misleading in that it implies this is a 4.5 feature, when it reality it's a 4.0 and 4.5 feature.
Validating WCF service:
It provides warning messages to the user when an input string is not in the correct format in a XML file".
The complete code of web.config looks like this:
<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IService1"/>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:4164/Service1.svc" binding="basicHttpBinding"contract="WCFApp.IService1" bindingConfiguration="BasicHttpBinding_IService1"name="BasicHttpBinding_IService1"/>
    </client>
  </system.serviceModel>
  <system.web>
    <compilation debug="true"/>
  </system.web>
</configuration>
 

The output of configuration validation error looks like this:

1 comment:

Thanks for commenting..,,

Copyright © 2016 CodeSharing| Design by CodingSharing.