ControlService Can't Open Windows Service

Apr 3, 2009 at 3:07 PM
Using Team Build (TFS2008 SP1) I'm attempting to use the ControlService class to stop a Windows Service on the build server. The Build process is using the Team System service account to perform the build. However, my builds only partially complete and the build log shows the error "Can't open <servicename> on computer <buildserver>.

We've gone so far as to make the Team Foundation service account a local administrator on the build machine and that has not resolved the issue. Has anyone else encountered this issue? Any advice on how to resolve it?

Thanks for any help that you can provide!!!!
Developer
Apr 9, 2009 at 7:30 AM
what sort of error are you getting?

Apr 9, 2009 at 12:54 PM

Mike,

When I posted my original message we were getting the following message in the build log:

Using "ControlService" task from assembly "D:\Build\Microsoft.Sdc\Microsoft.Sdc.Tasks.dll".
Task "ControlService" Service is Running, attempting to stop: <SERVICENAME>
<BUILDFOLDER>\TFSBuild.proj(251,5): error : Cannot open <SERVICENAME> service on computer '<BUILDSERVER>'.

The TFS Build service is running using the TFS Services account and our windows service is running under the Local System account.

Later, we set up the TFS Services account with the permission to log on locally. We attempted to stop the service while logged in as TFS Services and received the message: "Error 5: Access Denied". This morning, I added the TFS Services account to the local Administrators group. This appears to have fixed the issue and now the ControlService task was able to stop the service:


Using "ControlService" task from assembly "D:\Build\Microsoft.Sdc\Microsoft.Sdc.Tasks.dll".
Task "ControlService" Service is Running, attempting to stop: <SERVICENAME>
Service is Stopped: <SERVICENAME>
Done executing task "ControlService". 
This appears to be a permissions issue with the TFS Services account. We'll continue to investigate what permission needs to be granted to the TFS Services account so that it can interact with the Windows service without needing to exist in the Administrators group. Do you have any knowledge of what this permission/security setting needs to be granted in order to interact with a service?

Thanks for your help!!!!