Cannot open <MyService> service on computer '.'

Viewed 20644

I have a website created by C# which is to start a services in a server.

I created a services called MyService using this :

instsrv MyService %systemroot%\system32\srvany.exe

then I uses the following code to call it :

ServiceController service = new ServiceController("MyService");
try
{
    service.Start();
}
catch (Exception ex)
{
    Response.Write(ex.Message);
}

but when I access the website and trigger this event, it prompt me

Cannot open <MyService> service on computer '.'

Is it because of the security or permission problem?? Any guide with clear steps is highly appreciated.

4 Answers
Related