Why is my Windows service serving WCF not starting under LocalService or NetworkService

I have a simple windows service serving a WCF service. I want to start the Windows service under the LocalService account (or even the NetworkService account). However, when I try to run it under any of these accounts, it starts and then stops immediately. It starts and starts normally under the LocalSystem account. Any thoughts on how to decide why it will not work under LocalService or NetworkService.

Thanks,

David

+7
wcf windows-services
source share
2 answers

Thanks to suggestions for checking the event log from marc_s and ho1, I found out that I need to add namespace reservation as follows:

netsh http add urlacl url=http://+:1239/BOBPersistenceServer/ user="Local Service" 

See http://msdn.microsoft.com/en-us/library/ms733768.aspx and http://msdn.microsoft.com/en-au/magazine/cc163531.aspx for more information.

+9
source share

LocalSystem has extensive privileges on the local machine, while LocalService and NetworkService have minimal privileges. Thus, it is very similar to the fact that your service needs some privileges that are not in the LocalService . As marc_s notes in his comment, the first step is to check the event viewer to see if there are any relevant error messages.

If this does not help, try adding some exception handling from the startup code to the service and log all exceptions from the Event Log, I hope this gives you enough information to find out what it is. this requires higher privileges.

0
source share

All Articles