WCF error starting as Windows service

Asked

Viewed 277 times

2

I am trying to start a WCF as Windows service, but it returns me the following error:

HTTP could not register the URL http://+:80/. Your process has no access rights to this namespace (see website http://go.microsoft.com/fwlink/? Linkid=70353 for details).

How can I solve this problem, when it was a common executable, it worked perfectly, now as I am putting it as windows service, it keeps returning this error.

I’m doing it this way to start:

ServiceHost host = new WebServiceHost(typeof(Server));
            WebHttpBinding binding = new WebHttpBinding();
            binding.MaxReceivedMessageSize = 999999999;
            ServiceEndpoint point = host.AddServiceEndpoint(typeof(IServer), binding, url);
            point.Behaviors.Add(new WebHttpBehavior());
            host.Open();
            btnSalvar.Log(new string[1] { "CONECTADO" });

The problem is not the code, because as I already informed, it works on a common exe, the error happens after putting as windows service.

  • Is the Logon account in the service an account with permissions? You tried with an administrator account only to validate if the service starts?

  • Yes the account is an administrator ..

  • Then it must be a problem to reserve the url+namepace+port. In the message link you have the commands to grant permission to the user who is running the service. For example in Windows Server 2008 forward or Windows 7 forward, the command is this: netsh http add urlacl url=http://+:80/MyUri user=DOMAIN\user just put the login dominance you are using in the service

  • @Ricardopunctual I did so, but continues with the same mistake.

1 answer

1


I can not find the link where I found this answer, but this is how I solved the problem:

I was working on a WFC test service hosted on Windows Service (managed). So I added another base address for HTTP. When I started the service again, I received the same error. Then I changed the service account from "Local Service" to "Local System" and this solved the problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.