Friday, June 6, 2014

Understanding wcf config files

ok - looking at this config file can be pretty confusing: this is the config file for AbolWebService.svc, which also happens to consume another service called LendingSystemService.svc.

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>

  </system.webServer>

  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>   
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_ILendingSystemService" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint
        address="http://localhost:19554/LendingSystemService.svc"
        binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_ILendingSystemService"
        contract="LendingSystemServiceReference.ILendingSystemService"
        name="BasicHttpBinding_ILendingSystemService"/>
    </client>   
  </system.serviceModel>


  1. System.WebServer - this is an instruction that defines how this as a web application behaves (no matter what the app does)
  2. System.ServiceModel - anything related to services.
    1. Behaviors - defines how services published by this application will behave. For example, this tells the service to allow other applications to discover it, and to send exception details down the wire when something goes wrong.
    2. Bindings - A list if services consumed by this application and what protocol each uses
    3. Client - a list of services that are consumed by this application: 
      1. Where the service lives
      2. Which protocol it uses