Note that there are some explanatory texts on larger screens.

plurals
  1. POServiceHost is binding to multiple hostnames/base addresses
    primarykey
    data
    text
    <p>I'm running Windows 7 and Visual C# Express 2010.</p> <p>I have the following rule in my ACL:</p> <pre><code>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) </code></pre> <p>Not that it really matters, but I also have an appropriate entry in my <em>hosts</em> file:</p> <pre><code>127.0.0.1 www.example.com </code></pre> <p>I'm trying to self-host a WCF service within a console application:</p> <pre><code>var baseAddress = new Uri("http://www.example.com:8020/gamerecords/"); using (ServiceHost host = new ServiceHost(typeof(Acme.Gaming.GameRecordsImpl), baseAddress)) { ... } </code></pre> <p>I get the following exception:</p> <pre><code>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). ---&gt; System.Net.HttpListenerException: Access is denied </code></pre> <p>The reason is that <strong>ServiceHost</strong> tries to bind to any hostname (<strong>+</strong>), but the ACL rule only authorizes the current user for hostname <em>www.example.com</em>. If I change the rule to:</p> <pre><code>Reserved URL : http://+:8020/gamerecords/ User: Myricae\Dario Listen: Yes Delegate: No SDDL: D:(A;;GX;;;S-1-5-21-3389095862-38437692-3014067205-1001) </code></pre> <p>everything works fine. However I don't think that <strong>ServiceHost</strong> should really try to bind to any hostname; instead it should only publish the service at <em>www.example.com</em>. <strong>Why WCF attempts to bind to multiple hostnames?</strong>.</p> <p>I found <a href="http://www.differentpla.net/content/2008/03/odd-behaviour-wcf-base-addresses-and-httpsys-wildcards" rel="nofollow">a page</a> which describes a similar issue.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload