Take the 2-minute tour ×

I'm running Windows 7 and Visual C# Express 2010.

I have the following rule in my ACL:

Reserved URL            : http://www.example.com:8020/gamerecords/
User: Myricae\Dario
    Listen: Yes
    Delegate: No
    SDDL: D:(A;;GX;;;S-1-5-21-3389095862-38437692-3014067205-1001)

Not that it really matters, but I also have an appropriate entry in my hosts file:       www.example.com

I'm trying to self-host a WCF service within a console application:

var baseAddress = new Uri("http://www.example.com:8020/gamerecords/");

using (ServiceHost host = new ServiceHost(typeof(Acme.Gaming.GameRecordsImpl), baseAddress))

I get the following exception:

Unhandled Exception: System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http://+:8020/gamerecords/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details). ---> System.Net.HttpListenerException: Access is denied

The reason is that ServiceHost tries to bind to any hostname (+), but the ACL rule only authorizes the current user for hostname www.example.com. If I change the rule to:

Reserved URL            : http://+:8020/gamerecords/
User: Myricae\Dario
    Listen: Yes
    Delegate: No

everything works fine. However I don't think that ServiceHost should really try to bind to any hostname; instead it should only publish the service at www.example.com. Why WCF attempts to bind to multiple hostnames?.

I found a page which describes a similar issue.

share|improve this question

1 Answer 1

Did you start your application via "Run-as-Administrator"?

share|improve this answer
Thank you for your answer. The reason why I populate the ACL with those rules is because I want to avoid running the application with administrator privileges. If I run the application as administrator it works, but I can't understand why it tries to bind to any hostname instead of www.example.com only. –  damix911 Dec 20 '13 at 16:31
I think not only WCF, in general if you need to open a port on a machine Windows requires that you Run-as-Administrator. Check this out - msdn.microsoft.com/en-us/library/ms730935(v=vs.110).aspx –  Swab.Jat Dec 20 '13 at 16:34

Your Answer


