customBinding configuration of wcf service (Server and client configuration )

Thursday 22 January 2015

customBinding configuration of wcf service (Server and client configuration )

Server Configuration :
   <serviceBehaviors>
    <behaviors>
    <behavior name="S2L">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483646" />
        
        </behavior>
       
      </serviceBehaviors>
    </behaviors>
 <customBinding>
        <binding name="Binding name" closeTimeout="00:10:10" openTimeout="00:10:00" receiveTimeout="00:01:00" sendTimeout="00:02:00">
          <binaryMessageEncoding>
            <readerQuotas maxDepth="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"/>
          </binaryMessageEncoding>
          <httpTransport maxReceivedMessageSize="2147483647" hostNameComparisonMode="StrongWildcard"/>
        </binding>
      </customBinding>

 <services>
 <service name ="WCF_CW"  behaviorConfiguration="S2L">
        <endpoint address ="" binding ="customBinding" contract ="WCFInterface name"
            bindingConfiguration="Binding name"       />
      </service>
 </services>

Client Configuration :
   <binding>
   <customBinding>
  <binding name="Binding name">
     <binaryMessageEncoding>
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
       maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
     </binaryMessageEncoding>
     <httpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
      maxBufferSize="2147483647" />
    </binding>
   </customBinding>
  </bindings>
<endpoint address="Service address"
    binding="customBinding" bindingConfiguration="Binding name"
    contract="Service reference name . interface name" name="Binding name" />