C
Cash Foley
I'm attempting to stop a Windows Service from a Web Application. The
follow code generates a "Access is Denied" exception.
Can anyone help me with this?
Thanks in advance.
Cash
try
{
ServiceController[] services = ServiceController.GetServices();
foreach(ServiceController service in services)
{
if(service.ServiceName == "Service")
{
if(service.Status == ServiceControllerStatus.Stopped)
{
service.Start();
}
}
}
}
catch (Exception exc)
{
Response.Write("ERROR: " + exc.Message);
}
follow code generates a "Access is Denied" exception.
Can anyone help me with this?
Thanks in advance.
Cash
try
{
ServiceController[] services = ServiceController.GetServices();
foreach(ServiceController service in services)
{
if(service.ServiceName == "Service")
{
if(service.Status == ServiceControllerStatus.Stopped)
{
service.Start();
}
}
}
}
catch (Exception exc)
{
Response.Write("ERROR: " + exc.Message);
}