Search code examples
.netwcftcpportsharing

.Net Port Sharing EndpointNotFound


I have two machines host1 & host2. host1 is running a process communicating with a process on host2 with following two services:

net.tcp://host2:1000/Service1
net.tcp://host2:1001/Service2

While Service1 works fine Service2 return following error on host1:

System.ServiceModel.EndpointNotFoundException: Could not connect to net.tcp://host2:1001/Service2...no connection could be made because the target machine actively refused it

From host1 I did telnet host2 1001 which does succeed. I also tried netsh http show urlacl on both machines but it contained no information regarding my services.

How can I further debug this issue? what could be the problem?


Solution

  • There are several ways to try:

    1. You may need a port per binding (pick a port to use for TCP, one for HTTP maybe).

    2. Check to see if port 1001 is occupied by a program, or you can replace port 1001 with 1000.

    3. Review the ABCs of WCF - Address, Binding and Contract. The client must match the service to connect.