开发者

Why won't my Windows Service that is hosting a WCF Service run under LocalService or NetworkService accounts

I have a simple Windows Service hosting a WCF Service. I want to run the Windows Service under the LocalService account (or even the NetworkService account). However when I try to start it under either of these accounts it starts then immediately stops. It starts and runs OK under the LocalSystem account.开发者_开发技巧 Any thoughts as to how to work out why it will not stay running under LocalService or NetworkService.

Thanks,

David


Thanks to the suggestions to check the event log from marc_s and ho1 I found out that I needed to add a 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 details.


LocalSystem has extensive privileges on the local machine while LocalService and NetworkService have minimum privileges. So this sounds very much like your service needing some privileges that LocalService doesn't have. As marc_s says in his comment, the first step should be to check the event viewer to see if there are any relevant error messages in there.

If that doesn't help, try adding in some exception handling around the startup code in the service and log any exceptions to the Event Log, hopefully that would then give you enough information to figure out what it is that you're doing that requires higher privileges.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜