The error

HTTP could not register URL http://+:40000/Service.svc/.

Your process does not have access rights to this namespace
(see for details).

System.Net.HttpListenerException: Access is denied

The solution

With admin rights, run:

> netsh http add urlacl url=http://+:40000/Service.svc/ user=MACHINE\User

The confirmation

> netsh http show urlacl

Reserved URL            : http://+:40000/Service.svc/
    User: MACHINE\User
        Listen: Yes
        Delegate: No
        SDDL: D:(A;;GX;;;S-0-0-00-0000000000-0000000000-0000000000-0000)