I recently helped a customer who ran into this error:
System.ServiceModel.CommunicationException: The service endpoint failed to listen on the URI 'net.tcp://localhost/CalcultorService.svc/' because access was denied. Verify that the current user is granted access in the appropriate allowAccunts section of SMSvcHost.exe.config. ---> System.ComponentModel.Win32Exception: Access is denied
They had updated the <allowedAccounts> section of the smsvchost.exe.config file as described here and then restarted the Net.Tcp port sharing service but still hit this error. However, they didn't realize that there are additional services running inside of that same instance of the process. The services that share the same process instance are:
- Net.Tcp Listener Adapter
- Net.Tcp Port Sharing Service
- Net.Pipe Listener Adapter
- Net.Msmq Listener Adapter Correction: I realized after posting this that the Net.Msmq service actually runs in different instance of SMSvcHost.exe, so you shouldn't have to restart that service.
If any of those services are running on your machine, then you have to stop all of them, then restart them in order for the changes to the configuration file be picked up. Restarting the machine will also do the trick.