Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Access denied in ServiceController.stop command

Author  Topic 

juicyapple
Posting Yak Master

176 Posts

Posted - 2008-02-29 : 01:57:58
Hi I am having problem when attempt to stop window service in a remote machine. I did try this in local machine, it works well. Please help.

System.InvalidOperationException: Cannot open FileProc service on computer 'SERVER95'. ---> System.ComponentModel.Win32Exception: Access is denied
--- End of inner exception stack trace ---
at System.ServiceProcess.ServiceController.GetServiceHandle(Int32 desiredAccess)
at System.ServiceProcess.ServiceController.GenerateStatus()
at System.ServiceProcess.ServiceController.get_CanStop()
at Service.clsProc.ServiceController(String pstrService) in C:\Service\Service\clsProc.vb:line 815



controller = New ServiceController(drServices.Item("ServiceName"), drServices.Item("ServerName"))

If controller.CanStop Then
controller.Stop()
controller.WaitForStatus(ServiceControllerStatus.Stopped)
End If

juicyapple
Posting Yak Master

176 Posts

Posted - 2008-02-29 : 03:06:38
It is resolved. I just changed all the running services from local system account to user account.
Go to Top of Page
   

- Advertisement -