【发布时间】:2013-12-21 00:31:18
【问题描述】:
我创建了一个 Windows 服务,在 http://localhost:8080/SomeService 上托管 WCF 服务
Windows 服务配置为使用 NetworkService 帐户运行。
当我尝试启动服务时,出现以下异常:
System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL
http://+:8000/. Your process does not have access rights to this namespace
(see @987654321@ for details). --->
System.Net.HttpListenerException: Access is denied
我想要做的是向服务安装程序添加一些代码(例如在AfterInstall 中)以赋予服务适当的权限。
如何在 C# 中做到这一点?
编辑
我知道这项服务会安装在 XP、Vista 和 Win7 机器上,所以我需要在所有这些平台上都能运行的东西。
【问题讨论】:
标签: c# wcf http windows-services