How to be allowed to start/stop windows service via ASP.NET page
-
Hi, I have a website with a Page that can start or stop a Windows Service. I get the error: Cannot open Service Control Manager on computer 'NZDB-TST'. This operation might require other privileges. My code:
private void RunAlongServices(String ServiceName) { // Nog wel machinenaan aanpassen!!! ServiceController ctrl = new ServiceController(ServiceName, "NZDB-TST"); if (ctrl.Status.Equals(ServiceControllerStatus.Stopped)) { ctrl.Start(); } else { ctrl.Stop(); } }
How to solve this issue, so the Windows service(s) can be started or stopped via de website?
In Word you can only store 2 bytes. That is why I use Writer.
-
Hi, I have a website with a Page that can start or stop a Windows Service. I get the error: Cannot open Service Control Manager on computer 'NZDB-TST'. This operation might require other privileges. My code:
private void RunAlongServices(String ServiceName) { // Nog wel machinenaan aanpassen!!! ServiceController ctrl = new ServiceController(ServiceName, "NZDB-TST"); if (ctrl.Status.Equals(ServiceControllerStatus.Stopped)) { ctrl.Start(); } else { ctrl.Stop(); } }
How to solve this issue, so the Windows service(s) can be started or stopped via de website?
In Word you can only store 2 bytes. That is why I use Writer.
digimanus wrote:
This operation might require other privileges.
digimanus wrote:
How to solve this issue, so the Windows service(s) can be started or stopped via de website?
It appears you need to effect a change in privileges some way. What do you think the odds are that Microsoft has documented Privilege issues associated to using ServiceController? I guess those are pretty good odds. I also guess a simple Google search using the keyword MSDN along with other key words in your original post would turn up that documentation. Of course I am just guessing. Good luck.
-
Hi, I have a website with a Page that can start or stop a Windows Service. I get the error: Cannot open Service Control Manager on computer 'NZDB-TST'. This operation might require other privileges. My code:
private void RunAlongServices(String ServiceName) { // Nog wel machinenaan aanpassen!!! ServiceController ctrl = new ServiceController(ServiceName, "NZDB-TST"); if (ctrl.Status.Equals(ServiceControllerStatus.Stopped)) { ctrl.Start(); } else { ctrl.Stop(); } }
How to solve this issue, so the Windows service(s) can be started or stopped via de website?
In Word you can only store 2 bytes. That is why I use Writer.
asp.net runs under IUser_machine_name account. Do you think it has permission to run services? Why do you want to start/stop service from asp.net anyway? Can't you solve it using other ways?
Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
-
asp.net runs under IUser_machine_name account. Do you think it has permission to run services? Why do you want to start/stop service from asp.net anyway? Can't you solve it using other ways?
Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
Hello Yusuf, the reason I want this done via a website is to givethe real administrator of the website I am creating the possibility to control the services from the website. If it can be done indirectly with a command via the website it is allright too. So, do you know any better options?
In Word you can only store 2 bytes. That is why I use Writer.
-
Hello Yusuf, the reason I want this done via a website is to givethe real administrator of the website I am creating the possibility to control the services from the website. If it can be done indirectly with a command via the website it is allright too. So, do you know any better options?
In Word you can only store 2 bytes. That is why I use Writer.
digimanus wrote:
the reason I want this done via a website is to givethe real administrator of the website
So are you targeting website administrators? what does web admin has to do with windows services?
digimanus wrote:
I am creating the possibility to control the services from the website.
why? again I fail to see why web admin needs to interact with windows services. Windows services are meant to be running in the background on the server. Why do your application need to start/stop services. If there is a service your web app needs to interact, then make sure it is running. If needed you can change its properties from Services windows. If this is a windows service you wrote for the web application, then let it run automatically all the time. Alternatively, move the code to your code behind or write an assembly. If the target audience is Server Administrators then they need to remote login and perform what ever they want.
Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]