Enabling net.tcp in IIS7
Asked Answered
I

4

65

How can I make IIS handle net.tcp connections?

Instead answered 6/7, 2010 at 17:24 Comment(0)
S
128

You need to add net.tcp to the enabled protocols of your site. Go to IIS Manager, right-click on your website, go to 'Manage Web Site' or 'Manage Application', then to 'Advanced Settings...'. There you see 'Enabled Protocols'. It probably says http. Change it to http,net.tcp.

If you want to configure bindings, right-click on your website and go to 'Edit Bindings...'. The default net.tcp binding is 808:*.

If you want to use WCF services hosted by IIS behind net.tcp, you may also want to check whether you have activated the required Windows Features. Go to your Windows Features and check you have activated 'Windows Communication Foundation Non-HTTP Activation' (found under 'Microsoft .NET Framework 3.5.1').

When you activate this feature, you will get some extra Windows Services. If it still doesn't work, check that the Windows Service named 'Net.Tcp Listener Adapter' is running (it should start automatically but sometimes it doesn't and this is the first place I check when one of my net.tcp services stops working).

Schwartz answered 6/7, 2010 at 17:32 Comment(5)
what if i remove http from the protocols for the service in IIS and have only net.tcp. will the service be activated?Gust
If you do not want any http(s) traffic to IIS, this will work.Schwartz
I know this is an old answer, but what does it mean if "Enabled Protocols" doesn't show as an option in IIS manager? I'm using IIS 7.5 in Windows 7.Exposure
I suppose you are either looking in the wrong place or you do not have sufficient rights to do this (although I've never heard of this) or you may not have enabled the required Windows Features (maybe the 'Enabled Protocols' option is not visible if you haven't enabled 'Windows Communication Foundation Non-HTTP Activation', although that doesn't seem very likely).Schwartz
The problem I was having is that Net.Tcp Listener Adapter Service wouldn't finish starting... it would just hang. Adding, 'Windows Communication Foundation Non-HTTP Activation' fixed this... no idea why, but thanks : )Hemp
A
8

This might help someone in the future. I created a powershell script that will come in useful if you need to automate the creation of the bindings.

It will automatically check if the binding exists already and only add it when required.

Actual Script

Import-Module WebAdministration

$websites = Get-ChildItem 'IIS:\Sites'
$site = $websites | Where-object { $_.Name -eq 'Default Web Site' }
$netTcpExists = [bool]($site.bindings.Collection | ? { $_.bindingInformation -eq '808:*' -and $_.protocol -eq 'net.tcp' })

if (!$netTcpExists)
{
    Write-Output "Net TCP binding does not exist. Creating binding now..."
    # Create the binding
    New-ItemProperty 'IIS:\Sites\Default Web Site' -name bindings -Value @{protocol="net.tcp";bindingInformation="808:*"}

    Write-Output "Binding created"
}
else
{
    Write-Output "TCP Binding already exists"
}

Write-Output "Updating enabled protocols..."

Set-ItemProperty 'IIS:\sites\Default Web Site' -name EnabledProtocols -Value "http,net.tcp"

Write-Output "Enabled protocols updated"
Alumroot answered 22/9, 2015 at 14:6 Comment(3)
you will have to make sure that the .net features are installed and enabled on the machine...Donnelly
Can you include the script in the answer? The host is not accessible for me and the answer is useless without at least the essential parts of the script.Aviate
@Alexei yes I should have included that in my original answer. Hope this helpsAlumroot
C
7

The last step worked for me.

  1. Make sure that these protocols are defined in the “Advanced Settings” of the website enter image description here
  2. Make sure the features below are installed enter image description here
  3. The services below should be running enter image description here
  4. Your application pool should use Integrated pipeline
  5. Close IIS Manager, reset IIS, and open IIS Manager again
  6. Check the listenerAdapters section in the applicationHost.config file ( Located in C:\Windows\System32\inetsrv\config). If you don’t see those listener adapters you want to use in bindings, add them manually enter image description here Source: Missing bindings in IIS (net.tcp, net.pipe, net.msmq, msmq.formatname)
Carma answered 29/7, 2019 at 18:11 Comment(0)
I
0

In my case, I had to add the net.tcp protocol not only to the website, but to the application below it (right-click the application, advanced settings, enabled protocols).

Inutility answered 11/11, 2021 at 9:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.