windows-services

How can I reject a Windows "Service Stop" request in ATL 7?

I have a Windows service built upon ATL 7's CAtlServiceModuleT class. This service serves up COM objects that are used by various applications on the system, and these other applications naturally start getting errors if the service is stopped while they are still running. I know that ATL DLLs solve this problem by returning S_OK in Dl...

Running msiexec from a service (Local System account)

We are working on an update system for our software. The updater should in the background as a service, and when an update is available, downloads and installs it. We need the service to install the update since the msi requires elevation to run, but some of our clients will be restricted users. The MSI is a WIX MSI and does a Major U...

How do you debug a windows service that is being installed?

I know how to attach a debugger to a windows service, but I can't seem to get attached to one that's being installed and started by a windows installer. I've tried: Setting a Thread.Sleep(TimeSpan.FromSeconds(30)); at the beginning of the on-start, but when I try to attach in Visual Studio, the name of the service does not appear as an...

Timer in a Windows service - not really working?

I have a Windows NT Service in C# which basically wakes up every x seconds, checks to see if any mail notifications need to be sent out, and then goes back to sleep. It looks something like this (the Timer class is from the System.Threading namespace): public partial class MyService : ServiceBase { private Timer _timer; private...

How to store the Connenction String in only the Data Access Layer (.NET Class Library)

Hi! I got a solution that includes 3 different projects, a Class Library, a Web Service and a Windows Service. MySolution.DataAccessLayer (Class Library) Using Entity-Framework 3.5 to access the database. MySolution.WebService (Web Service) MySolution.WindowsService (Windows Service) My problem is that a have to include the Connect...

WCF host in windows service: cannot get wsdl

Hi guys! i've a windows service that hosts a WCF service with basicHTTPBinding. In test everything goes right, when i deploy the win service on a Window Server 2003, service hosts correctly wcf, I print out endpoints in tracing, they're correct, but when i ask for wsdl using the address that service exposed (i.e. http://mybaseaddress/?w...

.Net Windows Services and InstallState file - is it really needed?

I've got a number of managed code Windows Services for which we use the Frameworks InstallUtil tool to install into the service control manager. This tool creates a new file at install time with an extension of .InstallState. I have experimented with deleting this file and an uninstall still works fine afterwards. So my questions is, wh...

Windows service trace debug messages

HI I wrote a udp server classlibray i hosted it in windows form and it works fine. When i debug the trace and debug messages shows in output. When i host the cl in a windows service none of the debug messages is showing. Both cl and windows service is in debug there is no tracelisteniners specified so it should use outputstring.I even p...

Debug Windows Service

Scenario I've got a windows service written in C#. I've read all the google threads on how to debug it, but I still can't get it to work. I've run "PathTo.NetFramework\InstallUtil.exe C:\MyService.exe". It said the install was successful, however when I run "Services.msc", The service isn't displayed at all, anywhere. If I go into Task ...

Does anyone know how to detect whether a Windows Service is running through Java

There's plenty of information on running Java apps as services, but I need to know how to detect whether a windows service is running or not. Does anyone know how??? At the DOS prompt, I can run: tasklist /svc|findstr "NonRunningService" echo Return code for N onRunningService is %ERRORLEVEL% tasklist /svc|findstr "RunningService" echo...

C# Windows Service

Scenario I've created a windows service, but whenever I start it, it stops immediately. The service was concieved from a console application that used to subscribe to an event and watch processes on a server. If anything happened to process (i.e. It was killed), then the event would trigger the process to be restarted. The reason I'm te...

Detect a USB drive being inserted - Windows Service

I am trying to detect a USB disk drive being inserted within a Windows Service, I have done this as a normal Windows application. The problem is the following code doesn't work for volumes. Registering the device notification: DEV_BROADCAST_DEVICEINTERFACE notificationFilter; HDEVNOTIFY hDeviceNotify = NULL; ::Zero...

Windows service installed successfully but not responding after started.

I have a windows service written in C#, .Net framework 2.0. I installed it on three machines and it worked fine but on one machine (with .Net framework 2.0) the setup has installed the service successfully but the service is not responding after I start it. I check for this by checking whether a log file is created at a specific path ins...

C# Windows Service Multiple Config Files

Quick Question Is it possible to have more than 1 config file in a windows service? Or is there some way I can merge them at run time? Scenario Currently I have two config files containing the below contents. After I build and install my Windows Service, I can't get my custom XML Parser class to read the content because it keeps point...

Windows Service Fails on Launch

I'm trying to write a windows service. It installs fine, but fails when I run it with the following exception. I've searched for the string "MyNewProgramService", but I can't find any conversions that would throw this error. I've also added try/catch blocks to a bunch of code with custom exception handling without finding where this ex...

Programming a windows service

I have started prgramming a windows service. I have added a notify icon from the toolbox. It has the small notify icon that appears in the systray as a member of those icons. It works so far. So far I have a blank form. I have used the DoubleClick for the notifyIcon to bring up the form (I will use the form for something later). Now...

Is it possible to use components derived from TWinControl in a service?

I am creating a Delphi service. Is there any way to use controls derived from TWinControl within services? Ultimately the control and any controls I place on it will be saved to a bitmap. But anything I try I get "control has no parent window" error. I have successfully created a TBitMap and can accomplish the same functionality. Bu...

C# Windows Service Intermittent Method Call

Scenario I have a C# Windows Service that essentially subscribes to some events and if anything is triggered by the events, it carries out a few tasks. The Thing... ....is that these events are monitoring processes, which I need to restart at certain times of the day. Question What's the best way I can go about performing this task ...

Tomcat on Windows x64 using 32-bit JDK

Hoping someone can help. The rub: I can't get Tomcat 5.5 to start as a windows service on 64-bit windows using a 32-bit JDK. the details: I've been running Tomcat 5.5 on Windows Server 2008 (x64) as a service for some time using a 64-bit JDK. I'm being forced to install a 32-bit JDK on this 64-bit machine so I can make use of the Jav...

How do I detect that my application is running as service or in an interactive session?

I'm writing an application that is able to run as a service or standalone but I want to detect if the application was executed as a service or in a normal user session. ...