Error with WCF starting as a Windows service

2

I'm trying to start a WCF as a Windows service, however it returns me the following error:

  

HTTP could not register the URL link . Your process does not have access rights to this namespace (see link for details).

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

I'm doing this 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, as I have already reported, it works in a common exe, the error happens after putting it as a windows service.

    
asked by anonymous 25.06.2018 / 17:57

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 resolved the problem.

    
26.06.2018 / 21:54