windows-services

Run Windows Forms application as service?

I have a Windows Forms application that I wrote that does some monitoring of an inbox and database. The customer has informed me that it needs to run every time the server reboots. Shame on me for letting the customer change the requirements. I was thinking ... is there any way to make a Windows Forms application run as a service so t...

Uninstall before installing a windows service

I am reading about how you can create an .exe that will install a windows service to the server. Say I already have the windows service installed and I want to perform an update. Is there a way for the installer to uninstall (stop the service, delete it, uninstall it) the currently running service and then install the updated version? ...

Debugging my windows DLL that might be invoked from a Windows Service

Hi, I have my SNMP Extension Agent DLL that is called by the Windows SNMP Service (snmp.exe) everytime i do an snmpwalk (another console application) .I want to step into my DLL code that is called from the above Windows Service. How do i go about doing that? Thanks Som ...

How to detect problem with .net service that goes directly to stop state without error

I have a .Net service that has begun to refuse to start - the system log shows that it "was successfully sent a start control" and then five seconds later the "service entered the stop state". I have the Main() function of my service class wrapped in a try/catch block -- but when this situation occurs, no errors appear in my events log ...

How to detect if a Window can be Shown?

When an application is running as a Windows Service (written in .NET), what would be the best way to detect whether or not a user is logged on, and when a user logs on, to be able to begin displaying the necessary dialogs, or when that user has logged off, so the display of dialogs can be prevented? I hope I phrased this correctly :) ...

How can I programmatically stop/start a windows service on a remote box?

I want to write a console or Click Once WinForms app that will programmatically stop and/or start a windows service on a remote box. Both boxes are running .NET 3.5 - what .NET API's are available to accomplish this? ...

Installing a win32 service using MSBuild and Microsoft.Sdc.Tasks

I'm trying to install windows service using the Microsoft.Sdc.Tasks library. <ControlService Action="Install" ServiceName="Service1" User="XXX Password="XXX" ServiceExePath="$(DeployFolder)\XXX.exe"/> But I keep getting prompted for the user and password! This will not work as I'd like to have it as an automated build...

How can I find the process id from the service name/handle in Delphi?

I have the service name for a windows service in delphi, and I know how to get the handle from that as well. What I need to do is stop a service, and if the stop fails for some reason I need to kill the process associated with the service. The problem is that I have multiple services running from the same executable, so I can't use the...

How/Where to handle ConfigurationErrorsException in a windows service?

I have a windows service that has a custom configuration section. In the configSectionHandler class I am using attributes on the properties to validate the settings like this: //ProcessingSleepTime Property [ConfigurationProperty("ProcessingSleepTime", DefaultValue = 1000, IsRequired = false)] [IntegerValidator(MinValue = 5...

Windows Service running but event logs not working.

I have a windows service listening to messages from a queue but the messages are not read from the queue.I created an event log to check for logs during service startup and shutdown but the logs are not written. I do not want to debug the service since it is a painful process.Is there a way to solve this issue.The messages need to be rea...

In a .NET service application, where do I add the functions that it should perform?

I know how to "create" a Service application. I know what to write in the main() function. I know how to add an EventLog (or other components) to the service. I know how to define what happens when the service starts, stops or resumes. What I want to know is this... I want my Windows Service to perform certain function (like Indexin...

Windows Service or Task Scheduler for maintenance tasks?

I have a C# Application that does some maintenance tasks. It needs to run roughly every hour, although it's not too important if it's a bit off. And it has to run on a Win2003 Server with no one logged in. Basically I wonder if I should write a Windows Service, and if yes, if Thread.Sleep() is a proper way to pause the Thread for an hou...

Programmatically limit CPU Usage of a Thread running inside a Service

I'm using VB9 (VS2008). I've created a Windows Service that indexes some folders regularly. Is there a way I can put an upper limit on the CPU usage depending upon the current system state, i.e., if the system is idle, the thread can use the CPU as much as it needs, but if there are other programs/processes running then it should use t...

Task manager shows 9MB Mem Usage while the thread performing Service function is Sleeping

I'm developing a Desktop Search Engine in VB9 (VS2008). Is it normal for a Service to take up 9MB of Memory while the only Thread involved in the Service is sleeping? The code includes following import statements... Imports System Imports System.IO Imports Microsoft.Win32 Imports System.Threading There are a few class variables in t...

Microsoft Service Inter-Communication Problem

I am currently building two windows services: The first takes messages from an internet connection and inserts these into a database. This is designed to be fast and stable and not do any other processing The second performs a batch process with any new messages that have arrived since it last ran. I am trying to think of a way so th...

boost::interprocess between Windows service and user application.

Hi, I'm using boost::interprocess to communicates between two applications. When the two applications are launch by the same user, it works great. When one of the application is a service, it fails. I found that the shared media is in fact a file that is created in the "TMP" directory. So it fails because each application is creatin...

Hot to get the status of a Windows service in ASP / .net ?

I need to find a way to monitor the status of a list of Windows services over HTTP, preferably without any third party program). All I really need to be able to do is display the service name and its status ('Started' / 'Stopped'). I'm not an ASP programmer so this is a little outside my realm. I've searched and haven't been able to f...

Error 1053 while trying to restart/stop Tomcat 5.0.30 (installed as a windows service)

I have Tomcat 5.0.30 installed as a Windows service. This service is starting perfectly fine. However when I try to restart or stop the service from the Windows services console, I'm getting the following error: * Could not stop Tomcat service on Local Computer. Error 1053: The service did not respond to the start or the control...

How do I find the install directory of a Windows Service, using C#?

I'm pretty sure that a Windows service gets C:\winnt (or similar) as its working directory when installed using InstallUtil.exe. Is there any way I can access, or otherwise capture (at install time), the directory from which the service was originally installed? At the moment I'm manually entering that into the app.exe.config file, but...

What is a the 'best practice' for location of windows service logfiles?

A lot of windows services write daily log files to their application installation directory under "program files". Windows system apps (eg IIS) use %SystemRoot%\System32\LogFiles. Is something I should do for my service? ...