Attempting to stop a Windows Service in a Web Application
From: Cash Foley (news_at_cashfoley.com)
Date: 07/29/03
- Next message: Brian Gambs: "RE: ASPState Bug/Security issue"
- Previous message: Aadil Abbas: "How to impersonate the child process of an ASP.NET application"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 29 Jul 2003 13:32:31 -0700
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);
}
- Next message: Brian Gambs: "RE: ASPState Bug/Security issue"
- Previous message: Aadil Abbas: "How to impersonate the child process of an ASP.NET application"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|