Reputation: 299
I have developed a WCF service. Now I want my clients can access to it using sockets. I implemented a TCPListener system on my WCF service, but when I try to instantiate my TCPListener object in a separate thread, I get the following error: An attempt was made to access a Socket in a way that is forbidden by its access permissions.
My WCF service is hosted locally.
Someone to help me please ?
Thanks in advance
Upvotes: 0
Views: 446
Reputation: 151588
You shouldn't let your service implement a socket, communicating is the task of the Binding. You could implement a custom binding which instantiates a TCP channel, some hints here and here. You can also just use the net.tcp Binding, if performance is your goal.
Finally the error you get is pretty clear if you search it on the web: it means you're trying to listen on a port that requires administrative privileges or that is already in use.
Upvotes: 1