How To: Enable multiple netTcp port sharing for WCF end-points

Getting straight to the point, the checklist for this can be found here. 3 basic tasks need to be done: -

1. Enable port sharing by either adding an attribute in your code like below

NetTcpBinding binding = new NetTcpBinding("netTcpBinding");

binding.PortSharingEnabled = true;

serviceHost = new ServiceHost(typeof(MsiFacade35Service));

serviceHost.AddServiceEndpoint(typeof(IMsiFacade35Service), binding, "net.tcp://MyServer/MyServiceEndpoint");

Or by setting in the app.config like below=

<binding name="bindingNetTcp" portSharingEnabled="true" />

 

2. Enable and configure the Net Tcp Port Sharing Service – which involves the following

a. Enable the Application Server role with the TCP Port Sharing selected

b. Update the app.config for SmSvcHost.exe with the below config - https://msdn.microsoft.com/en-us/library/aa702669(VS.100).aspx **

c. Restart the “Net.Tcp Port Sharing Service” from services.msc

 

** One GOTCHA: Though the link says to go to “C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation”, for .NET 4, you would need to update the app.config in the below locations based on the bitness of the box and the .NET Build.

a. C:\Windows\Microsoft.NET\Framework\v4.0.30128 ** for .NET 4 RC – x86 CPU

b. C:\Windows\Microsoft.NET\Framework64\v4.0.30128 ** for .NET 4 RC – x64 CPU

You can confirm the correct location to update the app.config by going to services.msc and checking the executable path in the properties of the Net.Tcp Port Sharing Service.

Regards,

AlD