开发者

Hosting a WCF service from a Windows Service

开发者 https://www.devze.com 2023-03-07 17:54 出处:网络
I have made a Windows Service that host a WCF service on http://localhost:8080/SomeService The Windows Service is configured to run using the NetworkService account.

I have made a Windows Service that host a WCF service on http://localhost:8080/SomeService

The Windows Service is configured to run using the NetworkService account.

When I try to start the service, I get the following exception:

System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http://+:8000/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details). ---> System.Net.HttpListenerException: Access is denied

What I want to do is to add some code to the service installer (inside AfterInstall for example) to give the service the proper rights.

How can this be done in C开发者_JS百科#?

EDIT

I know that this service will be installed on XP, Vista and Win7 machines, so I will need something that works on all these platforms.


Try LocalSystem account. (filling remaining space)


Try "Run-as-Administrator" when you launch your application

0

精彩评论

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