Groups | Blog | Home
all groups > asp.net > september 2005 >

asp.net : ASP.NET + WindowsServices


George
9/30/2005 4:41:11 PM
1. The account ASP.NET runs under needs permissions to start/stop the =
service. Just add it to Admin group.
2. did you write the service "MyService" itself?
3. Why do you need to start/stop service from ASP.NET. The service =
usually starts automatically when windows starts.


George

[quoted text, click to view]
Hello,

I would like to access to Windows Service via ASP.NET. I have written=20
very simple web application which starts and stops windows service. =
Here=20
is my StarButton event:

private void StartButton_Click(object sender, System.EventArgs e)
{
ServiceController sc =3D new ServiceController();
sc.ServiceName =3D "MyService";
sc.Start();
}

When I try to start Windows Service I receive the following error:
System.ComponentModel.Win32Exception: Access is denied.

How to set up my web application or my Windows Service to have a=20
perrmission to stoping or starting Windows Service via ASP.NET. I'm=20
newbie in Windows Services and I would ask You for help.
Thank You in advance.

Andy
9/30/2005 10:27:17 PM
Hello,

I would like to access to Windows Service via ASP.NET. I have written
very simple web application which starts and stops windows service. Here
is my StarButton event:

private void StartButton_Click(object sender, System.EventArgs e)
{
ServiceController sc = new ServiceController();
sc.ServiceName = "MyService";
sc.Start();
}

When I try to start Windows Service I receive the following error:
System.ComponentModel.Win32Exception: Access is denied.

How to set up my web application or my Windows Service to have a
perrmission to stoping or starting Windows Service via ASP.NET. I'm
newbie in Windows Services and I would ask You for help.
Thank You in advance.

//Rutger Smit
9/30/2005 10:46:40 PM
Andy,

Well, for starting/stopping services you'll need the Administrator
rights. Haven't tried it myself but hey, it are the organs of your
Windows OS ;)

Cheers,
//Rutger

http://www.RutgerSmit.com

[quoted text, click to view]
Andy
9/30/2005 10:47:27 PM
[quoted text, click to view]
Yes.

[quoted text, click to view]
I will write in the future the specific web application that will
Andy
9/30/2005 10:50:30 PM
[quoted text, click to view]

There isn't the other solution ? I don't want that ASPNET runs under
AddThis Social Bookmark Button