Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am trying to learn wcf services. While hosting wcf service I am getting exception.

Error: " An unhandled exception of type 'System.ServiceModel.AddressAccessDeniedException' occurred in System.ServiceModel.dll
Additional information: HTTP could not register URL http://+:8080/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)."

Here is my code in app.config file.

App.config

XML
<system.serviceModel>
      <services>
        <service name="HelloService.HelloService" behaviorConfiguration="mexBehavior">
          <endpoint address="HelloService" binding="basicHttpBinding" contract="HelloService.IHelloService">
          </endpoint>
          <endpoint address="HelloService" binding="netTcpBinding" contract="HelloService.IHelloService">
          </endpoint>
          <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange">
          </endpoint>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8080/"/>
            <add baseAddress="net.tcp://localhost:8090/"/>
          </baseAddresses>
        </host>
        </service>
      </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="mexBehavior">
          <serviceMetadata httpGetEnabled="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    </system.serviceModel>



Program.cs
CSS
class Program
    {
        static void Main()
        {
            using(ServiceHost host= new ServiceHost(typeof(HelloService.HelloService)))
            {
                host.Open();
                Console.WriteLine("Host started @ " + DateTime.Now.ToString());
                Console.ReadLine();
            }
        }
    }
Posted

1 solution

It can be because of the security settings of the OS and the access level of the user account under which the program is running.

Here are some links that may help you.

https://thetechnocrate.wordpress.com/2012/07/16/system-servicemodel-addressaccessdeniedexception-http-could-not-register-url/[^]

http://stackoverflow.com/questions/609750/getting-system-servicemodel-addressaccessdeniedexception-on-vista-for-wcf-servic[^]
 
Share this answer
 
Comments
Keyur Dodiya 5-Jun-15 10:40am    
I have followed the this solution

https://thetechnocrate.wordpress.com/2012/07/16/system-servicemodel-addressaccessdeniedexception-http-could-not-register-url/[^]

but error occurs as "Following command was not found"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900