简体   繁体   中英

how to start a windows service from another windows service

i have windows service "monitoringservice" (account:localservice) and another service named

"uploadService" (account: local system), i installed the uploadService with setupproject and

when i start this upload service its working fine. but when i start the upload service with

the help of "monitoringservice" iam unable yo start the service iam getting the below error

"cannot open uploadService on the computer'.'"

Can any one suggest me please iam strck up with this problem

i used the following code

ServiceController sc = new ServiceController("UploadService");
                    if(sc!=null)
                    {
                        try
                        {
                            if (sc.Status != ServiceControllerStatus.Running && sc.Status != ServiceControllerStatus.StartPending)
                            {
                                sc.Start();
                            }
                        }
                        catch (Exception ex)
                        {

                        }
                    }

Thank you in advance

see the following for a description of the local service account

The local service account may not be able to start your other service due to permissions, change the account on your monitoring service to local system

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM