Hosting WCF service with netTcpBinding or netNamedPipeBinding in IIS

This article describes you necessary actions to host your WCF services with netTcpBinding or netNamedPipeBindings in IIS. IIS supports http or https protocols by default however to use netTcpBindings or netNamedPipeBinding you need to manage some settings.

Follow below steps to create WCF service with netNamedPipeBindings and host it in IIS.


  1. Create WCF library

    Create a new service using Create new WCF service library and test using WCFTestClient

  2. Host WCF Service in IIS

    Host the WCF Service using hosting WCF service in IIS

  3. Check TCP and Named Pipe Services

    For netTcpBinding and netNamedBinding respective services needs to be already started. Follow below steps to check it whether these services are started.


    1. Open Services window by executing command Services.msc from windows Run.
    2. In Services window check below services are started and if it is not then start it.
      a. Net.Pipe Listener adapter if you are using netNamedPipeBinding.
      b. Net.Tcp Listener adapter if you are using netTcpBinding.
      c. Net.Tcp Port Sharing services if you using netTcpBinding and sharing same port with multiple service endpoints.
      start services for netNamedPipe and netTcp

  4. WCF Non-Http Activation from Windows features

    Follow below steps to activate Non-Http protocols.


    1. Open control panel by executing command Control from windows Run.
    2. Click on Program and Features (if it is not listed on your window click on View by Small icon or large icon).
    3. Click on Windows Features Turn On or Off
    4. From new window locate Microsoft .Net Framework 3.5.1 and see the sub items of it.
    5. Make sure the check box for Windows Communication Foundation Non-Http Activation is selected. Turn Windows features on or off

  5. Enabled Protocols for net.tcp and net.pipe

    Follow below steps to enable Protocols.

    1. Open IIS manager by executing command inetmgr from windows Run.
    2. In IIS manager right click on your web site where your services are hosted -> select Manage Web Site -> select Advanced Settings
    3. In Advanced settings set the value for Enabled Protocol as http,net.pipe,net.tcp Enabled protocol for netTcp and netNamedPipe

  6. Edit Binding

    Follow below steps to enable Protocols.

    1. Open IIS manager by executing command inetmgr from windows Run.
    2. In IIS manager right click on your web site where your services are hosted -> select Edit bindings
    3. In Edit Bindings window check whether there are binding types available for net.tcp and net.pipe. If not then click on add and add the respective bindings.

      adding binding netNamedPipeBinding to site adding binding netTCPBinding to site

With this your services should be ready for consume with WCF services hosted in IIS.

If you are having multiple service endpoints with different bindings and different hosting environment see the article multiple wcf services in one solution with multiple endpoints and hosting.aspx

Download source code

Speak your mind :
Leave a comment for this article on dotnetbloogers.com