Follow the below steps to create a WCF service with netNamedPipeBindings and host it in IIS.
-
Create WCF library
Create a new service using
Create new WCF service library and test using WCFTestClient
-
Host WCF Service in IIS
Host the WCF Service using
hosting WCF service in IIS
-
Check TCP and Named Pipe Services
For
netTcpBinding
and netNamedBinding
respective services needs to be already started. Follow the
below steps to check whether these services are started.
- Open Services window by executing command Services.msc from windows Run.
-
In the 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 the same
port with multiple service endpoints.
-
WCF Non-Http Activation from Windows features
Follow the below steps to activate Non-HTTP protocols.
- Open the control panel by executing command Control from windows Run.
-
Click on Program and Features (if it is not listed on your window click on
View by Small icon or large icon).
- Click on Windows Features Turn On or Off
-
From the new window locate Microsoft .Net Framework 3.5.1 and see the sub items
of it.
-
Make sure the check box for Windows Communication Foundation Non-HTTP Activation
is selected.
-
Enabled Protocols for net.tcp and net.pipe
Follow the below steps to enable Protocols.
- Open IIS Manager by executing command inetmgr from windows Run.
-
In IIS manager right click on your web site where your services are hosted -> select
Manage Web Site -> select Advanced Settings
-
In Advanced settings set the value for Enabled Protocol as http,net.pipe,net.tcp
-
Edit Binding
Follow the below steps to enable Protocols.
- Open IIS Manager by executing command inetmgr from windows Run.
-
In IIS manager right click on your web site where your services are hosted -> select
Edit bindings
-
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.
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