Questions tagged [servicecontroller]
104 questions
1
vote
1 answer
Can't start a service by C#
I have a problem to start a Service by C#. I get this error message:
System.ComponentModel.Win32Exception (0x80004005): Access denied.
How can I have the permission?
My easy code it's:
ServiceController s = new ServiceController("Service1",…

Riccardo
- 9
- 3
1
vote
1 answer
ServiceController just get stuck without any exceptions
I'm using ServiceController to restart windows server. Here is my C# code.
ServiceController service = new ServiceController("ServiceName");
service.Stop();
service.WaitForStatus(ServiceControllerStatus.Stopped,…

Vladimir
- 11
- 2
1
vote
0 answers
ServiceController can't start service on Windows 10 1709+ when using an IPv4 address and non-admin user
We have a Windows Service that sits and monitors our main Windows Service. It can query the service status, stop, start, and restart the service as required. It does so using the ServiceController class in .Net.
When installed using our installer,…

dkwarr87
- 204
- 2
- 10
1
vote
1 answer
Create a collection of Windows Services matching a regular expression
I want to create a collection of Windows Services that will match a regular expression using a Where clause.
For example, I have 3 Windows Services called:
RCLoad1
RCLoad2
RCLoad3
my Regex would be something like: "^RCLoad*"
I'd like to use…

user3772839
- 265
- 3
- 11
1
vote
0 answers
Cannot open Service Control Manager on computer "server name". The RPC server is unavailable
I have been trying to solve this issue and unfortunately still not successful. I can access the Server remotely and have rights to the server. We are on the same domain but unfortunately when my program is trying to control the server services is…

T.G
- 11
- 3
1
vote
0 answers
Unreliable and extreme delay monitoring Service status
Im currently developing a program in C#, that monitors the status of services, running on a server. I'm using System.ServiceProcess.ServiceController's waitforstatus funktion. The Problem is, if I run my program as an Consol-Program, everything…

Drago
- 21
- 1
- 5
1
vote
0 answers
Check and change windows service status by C# WebApplication
I need to check and change the status of the webservices on the server by webapplication. I have searched and tried many solutions like thisone. but no success. I can perform the codes of changing service status on local machine with starting my…

Rush.2707
- 685
- 10
- 29
1
vote
2 answers
Control a service on a remote server from IIS
Please note: In each step I describe below I'm logged in as the same domain user account.
I have a web application that controls a service on a remote machine (via ServiceController). When I connect to the website remotely and attempt to control…
user1228
1
vote
1 answer
Windows service controller: view `sc failure` settings for a service
I would like to view the current settings of sc failure for a service. Is this possible?
Background:
I'm setting up state configuration for services using Saltstack. Right now, when a service is set up, a command line is run to set the failure…

laffoyb
- 1,540
- 3
- 22
- 35
1
vote
1 answer
Windows sc.exe command: Access is Denied when querying service on a remote machine
I am trying to query a service on a remote machine using the windows sc command but keep getting the following error [sc] enumqueryservicesstatus openservice failed 5 Access is denied, any body have an idea what exactly i need to change on the…

JCS
- 897
- 4
- 20
- 43
1
vote
2 answers
.NET service detection (If Exists?)
Apologies if this is a stupid question, but I'm learning and I'm trying to use all the documentation at my disposal and I've got reasonably far, however I'm stuck on one last area.
Problem
I'm trying to detect if a service exists/is running and…

Samuel Nicholson
- 3,587
- 3
- 20
- 37
1
vote
1 answer
Controlling a service using ServiceController versus using services.msc, with UAC enabled
I'm working on an application that manages services that make up some product.
Up to now, it was foreseen that this application was started with elevation (so the user had to confirm a UAC prompt).
It appeared that for most operations, elevation was…

user3110963
- 33
- 5
1
vote
1 answer
Service: optional dependencies
Let's imagine that I have a service that can invoke other services depending on method that is called:
class Foobar
{
public function foo() {
return *SERVICE_A*->baz();
}
public function bar() {
return…

Anton Zhdanov
- 165
- 9
1
vote
1 answer
Do you know any alternatives to ServiceController class (C#)
The problem is that we don't have a way to 'cancel' a slow/never starting service once we attempted to start it, if its taking too long:
ServiceController ssc = new ServiceController(serviceName);
ssc.Start();
…

safejrz
- 544
- 1
- 14
- 26
1
vote
1 answer
How to stop a windows service that has multiple threads cannot be stopped
I have a windows service written in C# that creates multiple threads, and some threads have legacy code and I don't have enough time/access to legacy code to wait for all these threads to stop before OnStop() completes. Again at some point I dont…

user1839788
- 21
- 1
- 4