I have wrote some posts about WCF and today I am going to write about configuring netTcpBinding in WCF as it needs some little extra work. WCF or Windows Communication Foundation is one my favorite areas in the .NET Framework and bindings is one of the things which I like the most in WCF.
Before starting off, there is a small check list to be checked. First is, you can’t configure netTcpBinding, if your service is running in the Visual Studio Development Server. The reason for this is Visual Studio Development Server only supports HTTP. And to configure netTcpBinding, we need IIS 7. This will not work on previous versions of IIS.
Next you have to make sure “Windows Communication Foundation Non-HTTP Activation” is available. Since I am using Windows Server 2008R2 operating system, it’s on the .NET Framework 3.5.1 Features under Features in Server Manager.
Then you can click on "Create Virtual Directory" button or if you run the project for the first time without clicking it, you will be asked before Visual Studio creating a directory for you. After creating the virtual directory you can see it under “Default Web Site” in the IIS.
|Default Web Site in IIS|
Now you have to do two configurations in IIS. Right click on “Default Web Site” and click on "Edit Bindings". Check whether net.tcp type is there and if not add it.
|Default Web Site : Site Bindings|
|Advanced Settings of created virtual directory|
And that's it. In here please note that I have put httpGetEnabled to "false". Now right click on the Service and view it in your browser. You will get something like this.
Now you can test this service by adding a service reference from another project or by using WCF Test Client which is located at,
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\WcfTestClient.exe".In here I am using the WCF Test Client.
|WCF Test Client|
|WCF Test Client : Testing the service|