Derik Whittaker

Syndication

News


Registration Error while Hosting WCF Services in a Windows Server

Have you ever run into the following error while trying to host (start) a WCF service inside a Windows Service?

Starting WCF Services step has caused the following error HTTP could not register URL http://+:9997//Services/HashGenerationService/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).

If you have you are not along. Also, if you have clicked on the link for MS and felt like that was absolutely NO help, you still are not alone.

The simplest (maybe not the best) way to solve this issue is to configure your windows service (the one hosting your WCF services) to log on as ‘Local System Account’ as below.

image

Once you have done this try restarting your service and see if your wcf services start as expected.

Hope this helps.

Till next time,


Posted 02-11-2010 1:46 PM by Derik Whittaker
Filed under: , ,

[Advertisement]

Comments

Alexander Groß wrote re: Registration Error while Hosting WCF Services in a Windows Server
on 02-11-2010 5:27 PM

The recommended way is to add an URL registration for the service account in question:

netsh http add urlacl url="http://+:9997//Services/HashGenerationService" user="your-domain\service-account"

Derik Whittaker wrote re: Registration Error while Hosting WCF Services in a Windows Server
on 02-11-2010 6:03 PM

@Alexander,

I am not sure this is something we want to do as we load our services dynamically via a plugin architecture.

Alexander Groß wrote re: Registration Error while Hosting WCF Services in a Windows Server
on 02-11-2010 7:43 PM

Derik,

That's interesting.

I do something similar with my current project: We register IWcfService<T> in the container and resolve all implementations during service startup. I also have a deployment script that registers the URL reservation before installing/starting the service. (We deploy our solution with MSDeploy and run that script post-update.)

An option might be to have a shared base address that's reserved and there to run all your services under, like http://+:9997/Services. Service instances would only have to specify the relative part, like /HashGenerator, etc.

As for running services under LocalSystem, I would definitely not want that from an administrative perspective. If I were the admin I would like to lock down services to run under the least privileges possible. We also use NTLM exclusively to connect to SQL Server. Having LocalSystem access databases is, IMHO, scary and (again from an administrative point of view) a smell.

Alex

Scott Seely wrote re: Registration Error while Hosting WCF Services in a Windows Server
on 02-12-2010 8:52 AM

Derik-- I concur with Alex's point. You want the reservation for the URL space that a given identity can own. While I appreciate the fact that you are using a plugin architecture, this is a case where you need to leak the abstraction a bit in order to keep some semblance of security in your app.

Derik Whittaker wrote re: Registration Error while Hosting WCF Services in a Windows Server
on 02-12-2010 8:57 AM

@Scott and @Alex,

Thanks for your input, i will see what i can do to do this the right way.

@Scott, can we chat off line?

Roel wrote re: Registration Error while Hosting WCF Services in a Windows Server
on 02-17-2010 7:02 AM

You can also use some of the sample code provided here blogs.msdn.com/.../addressaccessdeniedexception-http-could-not-register-url-http-8080.aspx

and use the HttpNamespaceManager to add your current namespace for the user who is running the servicehost.

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)