Why can't I connect to a WCF service with net.tcp but i can with http?
Solution 1
Check out this post on enabling non-HTTP bindings in IIS 7.0. By default, you have to explicitly enable net.tcp in IIS 7.0.
Hope this helps.
UPDATE:
Saw your comment - unfortunately, net.tcp is not supported in IIS 6.0. Check out this link which details the supported WCF bindings for various hosts (including self-hosting, WAS, and IIS). Looks like only HTTP bindings work in IIS 6.0.
Solution 2
For anyone that stumbles accross this, my guide to trouble-shooting net.tcp WCF issues like this:
- Check that net.tcp is an enabled protocol for the web site (in IIS, right-click the site, goto advanced settings, and ensure that Enabled Protocols includes "net.tcp"
- I'm not sure if this is a paranoia thing, I also have always needed to enable net.tcp for the Site via the command line as well as step 1. Open a command prompt, and from
c:\windows\system32\inetsrv
, enterappcmd.exe set app "NameOfWebsite/" /enabledProtocols:http,net.tcp
- Check that the bindings for the website in IIS have an entry for net.tcp, and that you've bound it to the correct port number (for me, I use 9000:* as my binding to port 9000). Also check that no other websites in IIS are using the same net.tcp binding to that port
- Check that the "Net.TCP Listener Adapter" service is running.
Done.
Solution 3
Once i start Net.Tcp Listener Adapter Service, service is working fine for me.
Solution 4
Could it be something as simple as your firewall rules on the service host disallowing port 808?
Solution 5
check if IIS has both protocol pointing to same port number,i just found if that is the case,it will not work.
Comments
-
Per Hornshøj-Schierbeck over 3 years
I have a WCF service running on the IIS with a ServiceHostFactory. It's running fine with the WSHttpBinding but because of the speed and everything being on the same network (no firewalls) i want to speed up things a bit using the NetTcpBinding instead.
When i try to do that i get this error:
Could not connect to net.tcp://zzz.xxx.yyy/MyService.svc. The connection attempt lasted for a time span of 00:00:01.0464395. TCP error code 10061: No connection could be made because the target machine actively refused it x.x.x.x:808.
I'm using
SecurityMode.None
just to make sure that is not screwing me also i tried either of these on two different tries:binding.Security.Message.ClientCredentialType = MessageCredentialType.None; binding.Security.Message.ClientCredentialType = TcpClientCredentialType.Windows;,
Also i should point out, that i'm pulling quite a lof of data from one of the service calls, so i also put these (both on the http and the tcp attempts - setting maxMessageSize to 1000000)
binding.MaxReceivedMessageSize = maxMessageSize; binding.ReaderQuotas.MaxArrayLength = maxMessageSize;
It should be pretty easy getting it to work, so what am I missing?
UPDATE: I added the TCP port 808 to the website identity and tried again. Now i get this error:
You have tried to create a channel to a service that does not support .Net Framing. It is possible that you are encountering an HTTP endpoint.
-
Per Hornshøj-Schierbeck over 15 yearsI just double checked and there are no firewalls blocking internal traffic, but thanks.
-
Per Hornshøj-Schierbeck over 15 yearsThe service is hosted on IIS6 though :(
-
David Mohundro over 15 yearsRevised my answer... looks like IIS6 doesn't support anything but HTTP. I'm in the same boat here at work - we're stuck on Win2003 for now :(
-
Dominic Zukiewicz about 12 yearsThank you! 1,2 & 3 were in place but not 4. It was the Net TCP Listener Adapter (and dependent services) not running for me! Check Windows Process Activation Services, NET TCP Port Sharing and Net TCP Listener Adapter are all started
-
yairr almost 11 years#3 Worked for me. I had two sites sharing net.tcp:808. Even though the second site was completely disabled it didn't work!! This is the only place I've seen that net.tcp port's can't be shared across sites. Great info!
-
Jess over 10 yearsIt was obvious to me, but to add "net.tcp", just type it in the text box (comma delimited list).
-
CodingYoshi over 3 yearsThe link is dead. FYI.
-
David Mohundro over 3 years@CodingYoshi I updated it to point to archive.org, it seems like it that link is gone.