1
votes

Running a WCF service for testing on a local machine. In App.config I have:

<system.serviceModel>
    <services>
      <service name="Pizza.Services.PizzaService">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8733"/>
          </baseAddresses>
        </host>
        <endpoint address="pizza"
                  binding="basicHttpBinding"
                  contract="Pizza.Services.IPizzaService">

        </endpoint>
        <endpoint address="net.tcp://localhost:8733/pizza"
                  binding="netTcpBinding"
                  contract="Pizza.Services.IPizzaService">
        </endpoint>
      </service>
    </services>

If I run the app from VS2015 (as a regular user or administrator), I get:

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:8733. ---> System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions

Now my co-worker has vaguely explained about a Windows 10 security feature that will prevent users from grabbing a random port and giving it away to some service. So I opened the command prompt as admin and did:

netsh http add urlacl url=http://+:8733/ user=Everyone

Still the same error.

I've noticed similar questions, but none of them address my issue, I feel.

EDIT: One more thing I forgot to mention is that I've tried turning off the firewal and anti-virus without success.

2
error message text you have does not look similar to netsh urlacl permissions. Could you please help me to understand your configuration? Have you defined to endpoints (http and net.tcp) that listen the same port 8733? It it allowed? Try to remove one of them (net.tcp) and run applicationoleksa
Thanks for the comment. Noticed it just a minute ago.Jakov

2 Answers

5
votes

An endpoint binding was screwing things up. I've changed the port in:

<endpoint address="net.tcp://localhost:8733/pizza"
                  binding="netTcpBinding"
                  contract="Pizza.Services.IPizzaService">
</endpoint>

from 8733 to 8732 and it works. Basically, two endpoints were trying to use the same port.

0
votes

Restarting Visual Studio normally fixes this issue.