windows-services

How can I accomplish ThreadPool.Join?

I am writing a windows service that uses ThreadPool.QueueUserWorkItem(). Each thread is a short-lived task. When the service is stopped, I need to make sure that all the threads that are currently executing complete. Is there some way of waiting until the queue clears itself? ...

Looking for API to SC.exe utility, and an advice on self-updating Windows Service.

We have built a Windows Service that is running on client's machines, which occasionally downloads a newer version of itself, and then performs a self-update: installs a new service, starts it, stops the old one, and eventually deletes it. The service cannot stop itself directly and do other stuff, so it spins another executable, which d...

How to hook windows service.

I am successful in hooking windows Nt functions (registry and file systems and create process functions). However I am in the beginning stage of analysing about hooking services. I would like to confirm my idea. If somebody found it as wrong. Please correct me to learn. With the thought that service are long running executables, I assum...

Windows Service startup time

Is there a way to programmatically retrieve start-up time/duration for all the Windows Services that have started during boot in Windows XP? That is, the time the service was initialized to getting to the "started" state. Thank you in advance! P.S. I'm not asking for software recommendation. ...

Mongodb, sharding and multiple windows services

In order to get sharding to work I need to run two copies of mongod.exe. One as a shard and one as the config server. How can I install both mongod instances as windows services? ...

Why do HTTPWebRequests and the WebBrowser control seem to perform more slowly for me when run from an EXE invoked by a windows service?

So I'm running a Windows Service as a user. Admin rights. This service launches an EXE via Process.Start. Within the EXE, a WebBrowser control is used to navigate to a website, log in, handle all the security handshaking, and get some data. It comes back out, writes the data to a file. Not the most efficient process, admittedly, but...

Windows Service

Hi, I'm trying to write a small Windows Service in .NET 3.5, that check every 10mn or so if thee are new files in "C:\demofolder", then send e-mail out. So far, I made it to here like in the following code, then there's error in Public Sub New() Imports System Imports System.Timers Imports System.ServiceProcess Public Class TestMyServi...

C# windows services + long running workflow

Hey guys / gals, I am starting development of a windows service and would like to consult the braintrust at stackoverflow before getting too far into it as to the best way to handle it. This will be my first windows service and I am not really familiar with threading, which is what I am assuming will be the recommendations here (but am...

Error 1053: The service did not respond to the start or control request in a timely fashion?

I build a windows service and I am getting the Error 1053 and not sure why. This is what my onstart looks like : protected override void OnStart(string[] args) { var workerThread = new Thread(Worker); workerThread.Start(); } I spawned off a new thread as I should but I am still getting no joy. ...

Throttle number of requests across WCF services

I have a WCF service load balanced across three different machines. Let's say these services can process requests of types A, B, and C. There are no limits to processing A or B. However, we can only process 5 requests of type C at a time, so if a 6th request of type C comes in, it'll have to wait until one of the previous requests ...

How can I add programatically service dependencies to an installed Window service ?

How can I add programatically service dependencies to an installed Window service ? It would really helpful, If someone suggest solution using WMI through the System.Management namespace . What is property for dependencies on which I can set services? ...

Alternative of Dispatcher class (from .net 3.0) to use in .net 2.0 context

Hi guys, I need an alternative for Dispatcher (.net 3.0) to use for a windows service (done in .net 2.0). Can you give me some idea how to achieve something like that or point me some links? I know that a dispatcher has a SynchronizationContext behind, but I don't know how I can use a SynchronizationContext into a service. If you thin...

Can a Service Write to Registry [HKLM]

I am writing a service for Windows Vista/7 which needs read/write/delete access to the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons Are there any special considerations I must make just in case the target system has UAC enabled and the service must always run with administrator privi...

Error while installing Windows Service

I am creating a test Window's service and not able to see the service in the ServiceManager. Steps performed... Select Windows Service project - Default Name is WindowsService1 Added some code in OnStart and OnStop menthods Right click on Sevice1.cs ( Designer and say Add installer), which adds a new file called ProjectInstaller.cs an...

How to be notified when service stop requested

Hello all, I got below code from http://tech.einaregilsson.com/2007/08/15/run-windows-service-as-a-console-program/ When running in console mode, I would like to be notified when service is requested to stop, rather than waiting user input. ( I mean here user requested to stop program via Ctrl+C or by closing console) It is trivial tha...

Running long process in aspx vs windows service

Wondering if there is a performance difference between letting a long running process hang in asp.net vs running the process via a windows service. I have done this once before and the windows service was much quicker and didnt bog down my system, whereas the asp.net request seemed to wreak havoc. I have no idea why, but I need to expl...

Windows service Process.Start not working under network service account

Edit For anyone having an issue, it turns out to be, as usual, a simple problem to solve. The keys need to be installed under the service account. Log on to the workstation under the service account, install the keys, and then it can be run from any session that would be launching it under the service account context. Problem solved. ...

Limit WCF service resources usage

Hi, I'm developing a web application that needs to perform a task that consumes a lot CPU and Memory, and that also may last several minutes. In order to get a better user experience, I also developed a windows service that hosts a WCF service that performs this "high cost" task and that comunicates with the web app using msmq (message ...

Windows Service multiple services in servicesToRun

Is it possible to add multiple services to the ServiceBase array and are they started in different threads? This is my current code: var servicesToRun = new ServiceBase[] { new DenormalizeSessionsService() }; ServiceBase.Run(servicesToRun); Now I want to add a...

Windows Service installer

I created a Windows service and an installer for it. Now I want to run the windows service under account say na\test.\ I am specifieng it in Projectinstaller. this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.User; this.serviceProcessInstaller1.Password = "pass123" this.serviceProcessInstaller1.Username = ...