Friday, July 4, 2014

Convert existing BizTalk WCF service from “http” binding to “netTCP” binding

Problem Statement
Need to convert existing BizTalk WCF services with “http” bindings to “netTCP” bindings.

After the introduction of WAS (Windows Process Activation Service) with IIS 7.0 (and later versions) it is possible to for IIS  to provides support for other protocols besides HTTP, such as TCP,MSMQ and Named Pipes etc.  So by making use of this feature we can host netTCP WCF services also on IIS.
If the BizTalk receive location already configured with WCF-Service (with http bindings) and if we need to convert it to netTCP bindings . Then after following below steps we can do so.

We assume that existing webserives are WCF services with BasicHttpBindings. Now we need to concert then to netTCPBindings. Following are the steps to carry out this.

  • Following two services should be running.

a.       Net.Tcp Listener Adapter
b.      Net.Tcp Port Sharing Service


  •          Modify Web.config files of services.

a.       Open web.config file of service (which is currently on http binding).
b.      Add following lines under 
Configuration --> system.serviceModel--> bindings
        <binding name="NetTcpBinding_MyTestService" closeTimeout="00:01:00"
            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
            transactionFlow="false" transferMode="Streamed" transactionProtocol="OleTransactions"
            hostNameComparisonMode="StrongWildcard" listenBacklog="10"
            maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="100"
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
               maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
          <security mode="None">
            <transport clientCredentialType="Windows" protectionLevel="None" />
            <message clientCredentialType="Windows" />
c.       Add following lines under
Configuration --> system.serviceModel--> client

<endpoint address="net.tcp://localhost/TestServices/MyTestService.svc"
                binding="netTcpBinding" bindingConfiguration="NetTcpBinding_MyTestService"
name="NetTcpBinding_MyTestService ">
d.      Save web.config file.

  •        Enable net.tcp protocol on service by doing following steps.

a.       Navigate to Service and open Advance Settings.
b.      On field “Enabled Protocals” write “http,net.tcp” as shown below.

  •        BizTalk Server change with netTCP serice.

a.       Add host instance to WCF-netTCP adapter handler (Send and Receive both). If not exists.

b.    Update BizTalk receive location.
       as shown below

  •        Enable BizTalk Receive location
  •        Now try to browse the service, it should be running.