0

I have a need to do automated testing of a configuration of WCF bindings. I wrote a test that, in it setup, picks a random port number and binds to it with a WSHttpBinding. The test runs a ServiceHost for the duration of its execution and then shuts it down. This works, but then when the build agents try to run the test, I get this error:

System.Exception: Unable to set up service host ---> System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http://+:52361/Test/. 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

Is there any way to work around this? Can this "urlacl" mechanism be disabled??

UPDATE: This was a wild goose chase, as it turns out. This wasn't the error that was happening on the build agents. I flubbed it when gathering that information. Turns out the build agents are running elevated and don't run into the urlacl problem. The actual problem I was encountering was that a NuGet reference somehow hadn't had its corresponding assembly reference added to the .csproj file. How the tests worked locally, I don't know!

Jonathan Gilbert
  • 3,526
  • 20
  • 28

1 Answers1

0

The error is "The process does not have permission to access this namespace".
You can try the following methods.

  • Make Test public
  • Run the service as administrator
  • Run the command prompt as administrator, add URL to ACL netsh http add urlacl url=

https://www.codeproject.com/Questions/441371/When-Hosting-the-WCF-service-i-got-exception

WCF ServiceHost access rights

Lan Huang
  • 613
  • 2
  • 5