Tuesday 12 July 2011

WCF CommunicationException TCP error

When trying to get a WCF service working over TCP, if the following CommunicationException is thrown on calling the ServiceHost object’s Open method:

A TCP error (10013: An attempt was made to access a socket in a way forbidden by its access permissions) occurred while listening on IP Endpoint=0.0.0.0:8080.

The likely causes are (1) the endpoint is being used by another running process or (2) a firewall is blocking access to this port.

To resolve this, run the following netstat command to see all sockets in use:

netstat –a

If this endpoint is listed in the output from netstat, try changing the service endpoint address to use a different port. (If the service is running on a computer with Windows Firewall, the Windows Security Alert dialogue may appear - the dialogue provides an option to allow access through the firewall.)

If the error is still being thrown, check that the port is not being blocked by a firewall.

3 comments:

  1. Thank you Martin. Although I did not see the conflict in netstat, your article made me look at the port set for my website in IIS and compare it with the service end point.

    ReplyDelete
  2. Thaaaaaaanks man. Switching from port 8080 to 8081 solved the problem. Had to allow access through the firewall too.

    ReplyDelete
  3. That helped me too. Thanks!

    ReplyDelete