Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I connect to a WCF service with net.tcp but i can with http?

Tags:

People also ask

Does WCF use TCP?

The WCF TCP transport is optimized for the scenario where both ends of the communication are using WCF. This binding is the fastest WCF binding for scenarios that involve communicating between different machines.

What is Net TCP binding WCF?

This binding generates a run-time communication stack by default, which uses transport security, TCP for message delivery, and a binary message encoding. This binding is an appropriate Windows Communication Foundation (WCF) system-provided choice for communicating over an Intranet.

How do I enable NET TCP port sharing?

In the Name column of the list of services, right-click the Net. Tcp Port Sharing Service, and select Properties from the menu. To enable the manual start-up of the service, in the Properties window select the General tab, and in the Startup type box select Manual, and then click Apply.


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.