Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Hosting WCF Service with netTcpBinding on IIS7

0.00/5 (No votes)
16 Oct 2013 1  
 I hosted my wcf service with wsHttpBinding as well as netTcpbinding.While I hosted with netTcpBinding on IIS 7 follwing things I have considered,

This articles was originally at wiki.asp.net but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.

 I hosted my wcf service with wsHttpBinding as well as netTcpbinding.While I hosted with netTcpBinding on IIS 7 follwing things I have considered, hope it will be useful for others also . 

Web.Config should have following configuration settinggs to hosting WCF service on IIS7(WAS):

    <bindings>
      <netTcpBinding>
        <binding name="tcpbinding" portSharingEnabled="true">
          <security mode="None"></security>
          <!--<security mode="Transport">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"/>
            <message clientCredentialType="Windows"/>
          </security>-->
        </binding>
       </netTcpBinding>
    </bindings>
Trouble Shooting on IIS7.*
If following exception thrown while adding service reference-
Error:

Cannot obtain Metadata from net.tcp://win-2008:9002/Multibinding/Service1.svc
If this is a Windows (R) Communication Foundation service to which you have access,
please check that you have enabled metadata publishing at the specified address.

For help enabling metadata publishing, please refer to the MSDN documentation at 
http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error
URI: net.tcp://win-2008:9002/Multibinding/Service1.svc   
 
Metadata contains a reference that cannot be resolved: 
'net.tcp://win-2008:9002/Multibinding/Service1.svc'.

Could not connect to net.tcp://win-2008:9002/Multibinding/Service1.svc. 
The connection attempt lasted for a time span of 00:00:02.0374439. 
TCP error code 10061: No connection could be made because the target machine 
actively refused it .     
No connection could be made because the target machine actively refused it 
Step1: Make sure following services is enable for net.tcp
a.                Net.Tcp Listener Adapter
b.               Net.Tcp Port Sharing Service
     If not then enable and start both services.
Step2: IIS Manager -> Select Hosted service -> Action pane -> Advance setting ->
           See Enable Protocol, by default http protocol there, need to specify net.tcp with comma separated
Step3: Make sure your application pool is running in classic mode
 
 
Step4: Right click on Default Website -> Edit bindings
            Make sure net.tcp protocol information there  
 
Step5: Check firewall, Create Inbound and out bound rule for port which we are using.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here