Questions tagged [windows-services]
Windows services are background service processes run by the Service Control Manager on Windows NT based operating systems, similar to daemons or UNIX services.
windows-services
9,023
questions
756
votes
21
answers
769k
views
How to solve "The specified service has been marked for deletion" error
I try to remove a Windows Service with sc delete <service name>, and encounter the following error:
[SC] DeleteService FAILED 1072:
The specified service has been marked for deletion.
...
625
votes
15
answers
845k
views
How do I uninstall a Windows service if the files do not exist anymore?
How do I uninstall a .NET Windows Service if the service files do not exist anymore?
I installed a .NET Windows Service using InstallUtil. I have since deleted the files but forgot to run
InstallUtil ...
584
votes
15
answers
1.0m
views
How can I delete a service in Windows?
I have a couple old services that I want to completely uninstall. How can I do this?
476
votes
13
answers
1.1m
views
Create Windows service from executable
Is there any quick way to, given an executable file, create a Windows service that, when started, launches it?
410
votes
21
answers
1.0m
views
Install a Windows service using a Windows command prompt?
I want to install a Windows service using a Windows command prompt (not the Visual Studio command prompt).
How do I do this?
395
votes
1
answer
331k
views
"Automatic" vs "Automatic (Delayed start)"
When installing Windows services there are two options for automatically starting a Windows service on Windows startup. One is Automatic, and the other is Automatic (Delayed start). What is the ...
357
votes
30
answers
300k
views
Easier way to debug a Windows service
Is there an easier way to step through the code than to start the service through the Windows Service Control Manager and then attaching the debugger to the thread? It's kind of cumbersome and I'm ...
342
votes
13
answers
435k
views
Modifying the "Path to executable" of a windows service
I'd like to modify the path to my application, but doing so breaks it because the service still points to the old location.
By going to Administrative Tools > Services you can open a properties ...
309
votes
18
answers
630k
views
Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154
I developed a Windows service using C#.NET to generate PDF report. To generate PDF file I am using a third party dll. The application is running in my Windows XP platform. When I deployed the service ...
264
votes
23
answers
462k
views
The type initializer for 'MyClass' threw an exception
The following is my Windows service code. When I am debugging the code, I am getting the error/ exception:
The type initializer for 'CSMessageUtility.CSDetails' threw an exception.
using System;
...
245
votes
4
answers
201k
views
What are the specific differences between .msi and setup.exe file?
I searched a lot, but all are guessed answers. Help me to find the exact answer.
242
votes
20
answers
349k
views
How to create a windows service from java app
I've just inherited a java application that needs to be installed as a service on XP and vista. It's been about 8 years since I've used windows in any form and I've never had to create a service, let ...
241
votes
14
answers
459k
views
Map a network drive to be used by a service
Suppose some Windows service uses code that wants mapped network drives and no UNC paths. How can I make the drive mapping available to the service's session when the service is started? Logging in as ...
230
votes
28
answers
293k
views
How can I run MongoDB as a Windows service?
How can I set up MongoDB so it can run as a Windows service?
208
votes
2
answers
216k
views
How can I verify if a Windows Service is running
I have an application in C# (2.0 running on XP embedded) that is communicating with a 'watchdog' that is implemented as a Windows Service. When the device boots, this service typically takes some time ...
204
votes
9
answers
458k
views
Run batch file as a Windows service
In order to run one application, a batch file has to be kicked off (which does things like start Jetty, display live logs, etc). The application will work only if this batch file is running. I am ...
201
votes
20
answers
233k
views
How to force uninstallation of windows service
I installed a windows service using installUtil.exe.
After updating the code I used installUtil.exe again to install the service w/o uninstalling the original version first.
When I now try to ...
190
votes
14
answers
584k
views
When creating a service with sc.exe how to pass in context parameters?
When creating Windows service using:
sc create ServiceName binPath= "the path"
how can arguments be passed to the Installer class's Context.Parameters collection?
My reading of the sc.exe ...
187
votes
7
answers
337k
views
How to uninstall a Windows Service when there is no executable for it left on the system?
How do I uninstall a Windows Service when there is no executable for it left on the system? I can not run installutil -u since there is not executable left on the system. I can still see an entry for ...
183
votes
11
answers
500k
views
How do you run CMD.exe under the Local System Account?
I'm currently running Vista and I would like to manually complete the same operations as my Windows Service. Since the Windows Service is running under the Local System Account, I would like to ...
181
votes
15
answers
302k
views
Check if a Windows service exists and delete in PowerShell
I am currently writing a deployment script that installs a number of Windows services.
The services names are versioned, so I want to delete the prior Windows service version as part of the installs ...
179
votes
7
answers
246k
views
Elevating process privilege programmatically?
I'm trying to install a service using InstallUtil.exe but invoked through Process.Start. Here's the code:
ProcessStartInfo startInfo = new ProcessStartInfo (m_strInstallUtil, strExePath);
System....
174
votes
10
answers
195k
views
.NET console application as Windows service
I have console application and would like to run it as Windows service. VS2010 has project template which allow to attach console project and build Windows service.
I would like to not add separated ...
173
votes
5
answers
236k
views
How to create an installer for a .net Windows Service using Visual Studio
How do I create an installer for a Windows Service that I have created using Visual Studio?
167
votes
7
answers
156k
views
Install a .NET windows service without InstallUtil.exe
I have a standard .NET windows service written in C#.
Can it install itself without using InstallUtil?
Should I use the service installer class? How should I use it?
I want to be able to call the ...
154
votes
18
answers
137k
views
How can a windows service programmatically restart itself?
I need to write robust code in .NET to enable a windows service (server 2003) to restart itself. What is the best way to so this? Is there some .NET API to do it?
148
votes
8
answers
168k
views
Install Windows Service created in Visual Studio
When I create a new Windows Service in Visual Studio 2010, I get the message stating to use InstallUtil and net start to run the service.
I have tried the following steps:
Create new project File -> ...
147
votes
9
answers
219k
views
How to install node.js as windows service?
I have downloaded node.js executable. How can I run that executable as windows service?
I cannot use standard node.js installer, since I need to run multiple version of node.js concurrently.
145
votes
8
answers
499k
views
How do I restart a service on a remote machine in Windows? [closed]
Sometimes while debugging, I need to restart a service on a remote machine. Currently, I'm doing this via Remote Desktop. How can it be done from the command line on my local machine?
142
votes
8
answers
319k
views
Start / Stop a Windows Service from a non-Administrator user account
I have a WindowsService named, say, BST. And I need to give a non-Administrator user, UserA, the permissions to Start/Stop this particular service. My service runs on a variety of Windows OS, starting ...
129
votes
32
answers
380k
views
Error 5 : Access Denied when starting windows service
I'm getting this error when I try to start a windows service I've created in C#:
My Code so far:
private ServiceHost host = null;
public RightAccessHost()
{
InitializeComponent();
}
protected ...
126
votes
13
answers
119k
views
Automatically start a Windows Service on install
I have a Windows Service which I install using the InstallUtil.exe. Even though I have set the Startup Method to Automatic, the service does not start when installed, I have to manually open the ...
126
votes
11
answers
104k
views
windows service vs scheduled task
What are the cons and pros of windows services vs scheduled tasks for running a program repeatedly (e.g. every two minutes)?
122
votes
19
answers
164k
views
System.BadImageFormatException: Could not load file or assembly (from installutil.exe)
I am trying to install a Windows service using InstallUtil.exe and am getting the error message
System.BadImageFormatException: Could not load file or assembly '{xxx.exe}' or one of its ...
119
votes
15
answers
414k
views
How to check if a service is running via batch file and start it, if it is not running?
I want to write a batch file that performs the following operations:
Check if a service is running
If is it running, quit the batch
If it is not running, start the service
The code samples I ...
116
votes
11
answers
219k
views
(SC) DeleteService FAILED 1072
Last time I create WAS profile and WASService then I try to config and run many script for learn how to config WAS, Finally it crash so i use wasprofile delete this profile and forgot delete ...
116
votes
11
answers
281k
views
Windows service on Local Computer started and then stopped error
Usually, I get this error:
(The "service name" service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other service or programs) when there's ...
108
votes
5
answers
59k
views
Inno Setup for Windows service?
I have a .Net Windows service. I want to create an installer to install that windows service.
Basically, it has to do the following:
Pack installutil.exe (Is it required?)
Run installutil.exe ...
108
votes
6
answers
209k
views
Best Timer for using in a Windows service
I need to create some windows service which will execute every N period of time.
The question is:
Which timer control should I use: System.Timers.Timer or System.Threading.Timer one? Does it influence ...
105
votes
10
answers
116k
views
Installing multiple instances of the same windows service on a server
So we've produced a windows service to feed data to our client application and everything is going great. The client has come up with a fun configuration request that requires two instances of this ...
103
votes
11
answers
98k
views
How do I create an InstallShield LE project to install a windows service?
I downloaded Visual Studio 2012 yesterday when it was released on MSDN. I have noticed that a few of the project types that we had in 2010 are gone or different. The biggest difference for me right ...
101
votes
5
answers
83k
views
What directory does a Windows Service run in?
I've created a very simple .NET Windows Service and installed it using InstallUtil.exe utility.
In the service I have a piece of code as such:
if (File.Exists("test_file.txt"))
{
// Do something ...
97
votes
33
answers
379k
views
Error 1053 the service did not respond to the start or control request in a timely fashion
I have created and installed a service a couple of times. Initially it was working fine, but after some changes in the service Code it start giving the error when I restart the service in Services.msc ...
95
votes
9
answers
271k
views
Stopping a windows service when the stop option is grayed out
I have created a windows service and in the service in control panel -> administrative tools -> services, its status is starting.
I want to stop this service, but the stop option is grayed out.
How ...
93
votes
6
answers
276k
views
Windows service start failure: Cannot start service from the command line or debugger [duplicate]
hi i'm getting this error
Cannot start service from the command line or debugger. A winwows Service must first be installed(using installutil.exe) and then started with the ServerExplorer, Windows ...
93
votes
4
answers
48k
views
Install Windows Service with Recovery action to Restart
I'm installing a Windows Service using the ServiceProcessInstaller and ServiceInstaller classes.
I've used the ServiceProcessInstaller to set the start type, name, etc. But how do I set the recovery ...
92
votes
4
answers
62k
views
sc.exe how to set up the description for the windows Service?
I am using sc.exe command to install C# windows service.
C:Windows\System32> sc.exe Create "TestService1" binPath= "C:\Program Files (x86)\Test\TestService1" DisplayName= "TestWindowsService1"
...
89
votes
8
answers
110k
views
System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security
I am trying to create a Windows Service, but when I try and install it, it rolls back giving me this error:
System.Security.SecurityException: The
source was not found, but some or all
event ...
88
votes
8
answers
108k
views
How to make a .NET Windows Service start right after the installation?
Besides the service.StartType = ServiceStartMode.Automatic my service does not start after installation
Solution
Inserted this code on my ProjectInstaller
protected override void OnAfterInstall(...
88
votes
6
answers
59k
views
How to check if a windows service is installed in C#
I've written a Windows Service that exposes a WCF service to a GUI installed on the same machine. When I run the GUI, if I can't connect to the service, I need to know if it's because the service app ...