Showing posts with label TCP. Show all posts
Showing posts with label TCP. Show all posts

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.