170

I get the following error when going through the WCF tutorial.

HTTP could not register URL http://+:8000/ServiceModelSamples/Service/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).

Is this something caused by a restriction on Windows 7?

Joshua
  • 26,234
  • 22
  • 77
  • 106
  • possible duplicate of [HTTP could not register URL http://+:8000/HelloWCF/. Your process does not have access rights to this namespace](http://stackoverflow.com/questions/8727293/http-could-not-register-url-http-8000-hellowcf-your-process-does-not-have) – G.Y Jun 07 '15 at 13:10
  • You can find a lot of useful information on this [blog](http://blogs.msdn.com/b/paulwh/archive/2007/05/04/addressaccessdeniedexception-http-could-not-register-url-http-8080.aspx). Hey also provides a nice GUI tool. – bob Jul 17 '11 at 13:21

9 Answers9

183

The issue is that the URL is being blocked from being created by Windows.

Steps to fix: Run command prompt as an administrator. Add the URL to the ACL

netsh http add urlacl url=http://+:8000/ServiceModelSamples/Service user=mylocaluser
Joshua
  • 26,234
  • 22
  • 77
  • 106
  • 4
    Glad you fixed that. What did the "+" mean? – John Saunders May 20 '09 at 01:29
  • I have a hunch that it means a generic local IP. – Joshua May 20 '09 at 11:22
  • 12
    Note: You pretty much have to enter url=http://+:port/path exactly. url=http://address:port/path did not work for me, as you would think it might. Also note that you have to use the network server as your user ("NT AUTHORITY\NETWORK SERVICE", if that's what your service's installer is set to. – Mike Pateras Jun 15 '10 at 01:58
  • 10
    Any way yo do this without needing an Administrator access? – setzamora Sep 10 '12 at 10:49
  • And for older versions of Windows like Server 2003 there's useful detail of what to do [in this blog](http://dmitrygusev.blogspot.co.uk/2009/07/host-wcf-service-in-windows-service.html) and not quite so useful [on the MSDN site](http://msdn.microsoft.com/en-us/library/ms733768.aspx) – Philip Jun 26 '14 at 09:44
  • 1
    using my account for the user didn't work. Worked with user=Everyone – Kim Nov 20 '14 at 06:38
91

If you are running via the IDE, running as administrator should help. To do this locate the Visual Studio 2008/10 application icon, right click it and select "Run as administrator"

Unsliced
  • 10,404
  • 8
  • 51
  • 81
Stephen Newman
  • 1,977
  • 14
  • 18
  • 22
    Not really a 'much better' solution @Liam - administrator privileges in a dev environment in a corporate setup could give you many more permissions to do dangerous things. A much easier solution, sure, but with power comes responsibility ... – Unsliced Jul 10 '12 at 09:02
  • 2
    Original solution also required execution as administrator - granted for a smaller period of time, and of course you need to be aware what you are doing from a security context. – Stephen Newman Jul 11 '12 at 15:03
  • 1
    so, anyway to do this without admin privileges? – setzamora Sep 10 '12 at 11:59
  • Perfect. I was running a program from IDE that needed to register a URL on another machine and running as administrator worked perfectly. – ThePartyTurtle Aug 08 '16 at 21:22
36

Another solution is to use the address

http://localhost:8732/Design_Time_Addresses/YOUR_ADDRESS .

.NET Framework (3.5) automatically register this address (http://*:8732/Design_Time_Addresses) for debugging scope. This is useful when you need to host services inside visual studio for debugging or testing. Don't use this on production...

Davide Icardi
  • 11,919
  • 8
  • 56
  • 77
  • 1
    Some sites refer to port 8731 instead of 8732. – Nenad Dobrilovic Aug 06 '12 at 12:31
  • 1
    @DaviFiamenghi As long as .net 3.5 is installed it should work. But I never tried. Usually I consider a test like this an integration test so I don't run it on TFS, I only run unit tests on TFS. – Davide Icardi Jun 26 '13 at 22:25
  • @NenadDobrilovic Mine uses 8733 :). But that is not important. – Hooch Sep 10 '14 at 09:05
  • 1
    Our server is using http://localhost:8733/Design_Time_Addresses/ and I'd have never known to look for it without your answer, thanks. Also, [Bob's tool](http://blogs.msdn.com/b/paulwh/archive/2007/05/04/addressaccessdeniedexception-http-could-not-register-url-http-8080.aspx) showed all of the addresses that were permissioned - that's how I discovered it was 8733. Thanks – Lee Oades Nov 13 '14 at 15:18
31

Open a command prompt as the administrator and you write below command to add your URL:

netsh http add urlacl url=http://+:8000/YourServiceLibrary/YourService user=Everyone
Metin Atalay
  • 1,375
  • 18
  • 28
3

Open Visual Studio as an Administrator.. It will run.

Vicky
  • 801
  • 7
  • 7
0

Other option that work is ..,

If you change de indentity in application pool, you can run the code, the idea is change the aplication pool execution account for one account with more privileges,

For more details use this blog

https://letrasandnumeros.com/2017/11/27/http-could-not-register-url-http-80-hellowcf-your-process-does-not-have-access-rights-to-this-namespace/

Lucaseto
  • 51
  • 2
-2

Running Visual Studio as administrator could fix the issue, but if you use Visual Studio with for example TortoiseSVN, you cannot commit any changes. Another possible solution would be to run the service as administrator and the rest Visual Studio as local user.

Doro
  • 671
  • 1
  • 16
  • 34
-2

I am working on Windows Vista. Even i faced the same problem but when i tried to run VS 2008 with administrative privileges, the issue resolved and my service was up and running. :)

-3

Please open your Visual Studio as administrator:

enter image description here

josliber
  • 43,891
  • 12
  • 98
  • 133
lalit
  • 13
  • 1