WCF Binding Performance

Just finished deploying at a client’s site and wanted to share some WCF tips…

If your server is Windows Server 2008 that supports WAS (Windows Activation Service), go for TCP Binding:

<netTcpBinding>
  <binding name="ultra"
            maxBufferPoolSize="2147483647"
            maxBufferSize="2147483647"
            maxConnections="2147483647"
            maxReceivedMessageSize="2147483647"
            portSharingEnabled="false"
            transactionFlow="false"
            listenBacklog="2147483647">
    <security mode="None">
      <message clientCredentialType="None"/>
      <transport protectionLevel="None" clientCredentialType="None"/>
    </security>
    <reliableSession enabled="false"/>
  </binding>
</netTcpBinding>
<!-- This is how you use it -->
<service behaviorConfiguration="DebugBehavior" name="WcfService.Initializer">
  <endpoint address="net.tcp://devserver:9999/ProjectXService/Setup" 
    binding="netTcpBinding" bindingConfiguration="ultra" 
    name="Setup" contract="ProjectX.WcfService.ISetup">
  <endpoint address="mex" binding="mexHttpBinding" name="mex" contract="IMetadataExchange" />
  <host>
    <baseAddresses>
      <add baseAddress="http://devserver/ProjectXService/Setup" />
    </baseAddresses>
  </host>
</service>

 

But our client is using Windows Server 2003 that does not support WAS, and we did not want to create a Windows Service as custom host, so the next best thing is to use HTTP Binary:

<customBinding>
  <binding name="binaryHttpBinding">
    <binaryMessageEncoding 
      maxReadPoolSize="2147483647" 
      maxSessionSize="2147483647" 
      maxWritePoolSize="2147483647">
      <readerQuotas maxDepth="32" 
                    maxStringContentLength="2147483647" 
                    maxArrayLength="2147483647" 
                    maxBytesPerRead="4096" 
                    maxNameTableCharCount="16384" />
    </binaryMessageEncoding>
    <httpTransport 
      maxBufferPoolSize="2147483647" 
      maxReceivedMessageSize="2147483647" 
      maxBufferSize="2147483647">
      <extendedProtectionPolicy policyEnforcement="Never" />
    </httpTransport>
  </binding>
</customBinding>
<!-- Initializer Service -->
<service behaviorConfiguration="DebugBehavior" name="WcfService.Initializer">
  <endpoint address="http://devserver/ProjectXService/Setup" 
    binding="customBinding" bindingConfiguration="binaryHttpBinding" 
    name="Setup" contract="ProjectX.WcfService.ISetup">
  </endpoint>
</service>

Hope it’s useful…

Share this post: | | | |
Published Wednesday, July 28, 2010 4:42 AM by zeddy
Filed under: ,

Comments

No Comments
Powered by Community Server (Commercial Edition), by Telligent Systems