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, also referred to as NT services, are background service processes run by the Service Control Manager based on the service settings and optionally restarted as needed. Windows services are also capable of being launched on demand, based on other service dependencies.

See also Introduction to Windows Service Applications

8974 questions
74
votes
5 answers

Windows service - get current directory

I have a Windows service that should look for a configuration file in its current directory. So I use directory.getcurrentdirectiry() but instead of the service directory I get back c:\windows\system32 Any idea why and how should I get the service…
MoShe
  • 6,197
  • 17
  • 51
  • 77
73
votes
10 answers

How to find windows service exe path

I have a windows service and I need to create directory to store some info. The directory path must be relative to the windows service exe file. How can get this exe file path ?
NDeveloper
72
votes
10 answers

New Windows Service installed, fails to start: "System error 2 ... system cannot find the file specified"

I have installed several other custom .Net windows services successfully. A new one I had recently written was very similar to the others and while it installed without error - on starting it with the service controller it failed to start with the…
Ho Ho Ho
  • 1,429
  • 1
  • 10
  • 10
70
votes
8 answers

How do I get the currently-logged username from a Windows service in .NET?

I have a Windows service which needs the currently logged username. I tried System.Environment.UserName, Windows identity and Windows form authentication, but all are returning "System" as the user my service is running as has system privileges. Is…
Raj
  • 3,890
  • 7
  • 52
  • 80
70
votes
11 answers

Stopping/Starting a remote Windows service and waiting for it to open/close

The top answer to this question tells me how to stop/start a remote service. Great. Now, all I need is to wait for the actual stop/start to complete. So, what I'm looking for is a dos command to: Start a service, should return only after the…
ripper234
  • 222,824
  • 274
  • 634
  • 905
69
votes
25 answers

Cannot start MongoDB as a service

I have been developing for MongoDB for some months now and would like to install it as a service on my Windows 7 Enterprise machine. The following is the command that I have executed to create the service: "D:\Milvia…
Martin Reich
  • 691
  • 1
  • 6
  • 3
68
votes
4 answers

How to install and start a Windows Service using WiX

I tried to use the code below in Wix. But when installing, the installer was freezing for like 3 minutes on status: Starting services, then I got this message "Service Jobservice failed to start. Verify that you have sufficient privileges to start…
Ray
  • 1,893
  • 7
  • 22
  • 24
68
votes
4 answers

How to get all Windows service names starting with a common word?

There are some windows services hosted whose display name starts with a common name (here NATION). For example: NATION-CITY NATION-STATE NATION-Village Is there some command to get all the services like 'NATION-'. Finally I need to stop, start…
Chandan Kumar
  • 2,617
  • 2
  • 19
  • 20
67
votes
19 answers

The designer could not be shown for this file because none of the classes within it can be designed

We have the following shared component: public class OurServiceBase : System.ServiceProcess.ServiceBase This class has functionality we want in all our downstream services, such as standardized execution scheduling and logging functionality. In a…
The Evil Greebo
  • 7,013
  • 3
  • 28
  • 55
66
votes
7 answers

How to create windows service from java jar?

I have an executable JAR file. Is it possible to create a Windows service of that JAR? Actually, I just want to run that on startup, but I don't want to place that JAR file in my startup folder, neither in the registry.
Rakesh Juyal
  • 35,919
  • 68
  • 173
  • 214
65
votes
3 answers

Error in installing Windows service developed in .NET

I have developed a windows service using C# and Visual Studio 2008. I have Windows XP SP2 installed on my machine. When I try to install the service using the installutil tool, after entering the username and password, I get the following error. An…
Sambha
  • 653
  • 1
  • 5
  • 4
65
votes
9 answers

Add nginx.exe as Windows system service (like Apache)?

I set up NGINX as a front end server for static content and I use Apache as a back-end server for other thing. The thing is I can't find a logical answer that allows me to make nginx.exe a Windows system service (like my Apache). Any come across an…
user1305810
  • 705
  • 1
  • 8
  • 10
64
votes
11 answers

Get startup type of Windows service using PowerShell

How can I get the Windows service startup type using PowerShell and not using WMI? I looked inside the Get-Service command, and it does not provide something to display the "startup type".
kubusz
  • 943
  • 3
  • 9
  • 17
64
votes
7 answers

How can I unit test a Windows Service?

.NET Framework: 2.0 Preferred Language: C# I am new to TDD (Test Driven Development). First of all, is it even possible to unit test Windows Service? Windows service class is derived from ServiceBase, which has overridable methods, OnStart…
dance2die
  • 35,807
  • 39
  • 131
  • 194
63
votes
9 answers

How to restart RabbitMQ service

I am getting a strange error while restarting the rabbitmq service and because of that I am unable to restart RabbitMQ service. I got this message from EventViewer and have tried to find solution by googling but no luck..please suggest. RabbitMQ:…
Shax
  • 4,207
  • 10
  • 46
  • 62