Questions tagged [servicecontroller]
104 questions
2
votes
1 answer
Is System.ServiceProcess.ServiceController.Stop() synchronous or asynchronous?
... or .Start() for that matter?
MSDN says nothing about it. There are no relevant google results that touch on this question. Reference source doesn't include the method body for some reason.
In testing it, it's tough to tell because the services…

rory.ap
- 34,009
- 10
- 83
- 174
2
votes
1 answer
Trying to start a windows service from a windows application giving System.ComponentModel.Win32Exception: Access is denied
I am trying to develop a windows application to start/stop and monitor status of two particular services.
The problem is I am getting
System.ComponentModel.Win32Exception:
Access is denied
Note that both services are local system
The…

IanCian
- 1,098
- 2
- 16
- 34
2
votes
0 answers
How can I detect that a person has stopped a Windows service?
I have a somewhat strange case to deal with...
I have Windows Service "A".
"A" is monitored for events in "B". "B" is an application that will restart "A" if "A" stops running.
"A" should not be restarted if the user manually shuts "A" down from…

Alexandru
- 12,264
- 17
- 113
- 208
2
votes
1 answer
How can i remotely access the windows services of a remote host in workgroup computers?
I am writing an application which is used to manipulate the windows services. My computer is in a workgroup. But i couldn't get access to the machine. I've tried Impersonation using LogonUser(). But is not working. I am able to manipulate using…

eeshwr
- 258
- 4
- 20
2
votes
2 answers
best way to access a windows service via GUI
I'm curious about the best way for a C# gui to access the functions of a Windows Service, be it WCF or ServiceController or some other option.
I'll explain what I'm doing: on a regulated time interval the service will be zipping one hours worth of…

Medic3000
- 786
- 4
- 20
- 44
2
votes
1 answer
Checking for an unregistered/missing service
How can I use ServiceController to tell me if a service has been registered or not? In the code fragment below, the check for a null DisplayName results in a System.InvalidOperationException.
Is there a straightforward way of doing this that I'm…

Talvalin
- 7,789
- 2
- 30
- 40
2
votes
4 answers
sc.exe to install an exe as a service?
I've been spending a lot of time reading about the sc.exe to run an executable as a Windows Service and it seems it should be fairly straighforward bu I'm having some issues get it to work without this error: error 1053 the service did not respond…

KJ3
- 5,168
- 4
- 33
- 53
2
votes
1 answer
Cannot stop the service using ServiceController in .NET 3.5
I'm working in .NET 3.5 and I have the problem with stopping some service using ServiceController. I searched whole internet and I found no solution to my problem ;)
Here's how I do that:
using (ServiceController service = new…

Peter
- 912
- 3
- 11
- 29
2
votes
2 answers
ServiceController.ExecuteCommand: how to get data back
In .NET, the ServiceController class allows you to send a custom command to a service using the ExecuteCommand method.
I would like to be able to query the service for its status (a custom notion of status, not the 'Started/Stopped' variety). I was…

David
- 15,750
- 22
- 90
- 150
2
votes
3 answers
Automatically Stop Windows Service at Uninstall
When my service is installed I have a handler that starts the service after it has been installed.
private void InitializeComponent()
{
...
this.VDMServiceInstaller.AfterInstall += ServiceInstaller_AfterInstall;
}
private void…

Mike Lorenzana
- 506
- 4
- 20
1
vote
3 answers
WPF making ServiceController[] Observable
So im trying to make a data-grid that displays some information about local window services, mine in particular, I would like to have the display name and status of the service, and then have a button to click to start or stop. I can link the button…

nagates
- 620
- 13
- 40
1
vote
2 answers
Modifying service control permissions in a Windows MSI installer
So right now I'm trying to change permissions on a windows service by using the command: sc sdset SERVICENAME PERMISSIONS
I have placed this in an MSI installer as an action and it seems to execute fine. However, sc requires administrator privlidges…

puttputt
- 1,259
- 2
- 14
- 25
1
vote
1 answer
Error when attempting to use System.ServiceProcess class to check status of Worker/Windows Service in .NET 6 C# Form application
I have created a Worker Service and a Windows Form Application, the Form application functions as a way to check if the service is installer or not, if it's running or not running.
I attempted using the System.ServiceProcess.ServiceController class…

Nordbo
- 11
- 5
1
vote
0 answers
Running a C++ Windows Service interactively in C#
I have a Windows Service written in C++ where I don't have the control over the source code, i.e. I cannot rewrite it. I also don't have the possibility to install it as a service and control it via ServiceController.
So the question is if it's…

Kristian Falk
- 51
- 4
1
vote
1 answer
ServiceController - Can't stop the service [C#]
I read many posts here with a similar question, but none helped me solve my problem.
I want to stop the service with the ServiceController object. But it fails and I get an exception: System.ComponentModel.Win32Exception (0x80004005). I don't…

Clyde
- 311
- 2
- 14