windows-services

Using Process.Start() to start a process as a different user from within a Windows Service.

I'd like to periodically run an arbitrary .NET exe under a specified user account from a Windows Service. So far I've got my windows service running with logic to decide what the target process is, and when to run it. The target process is started in the following manner: The Windows Service is started using "administrator" credentia...

Visual Studio 2008 Service Installer Project Upgrade issue

I've upgraded a [.vdproj MSI generator project built into VS2008] System.Configuration.Install.Installer with a ServiceProcessInstaller and a ServiceInstaller from Visual Studio 2005 to 2008. There are no customisations of consequence to the installer class (i.e., not trying to start or stop services or register children) RemovePrevious...

Does ServiceBase.OnStop get called when a .Net 2.0 service crashes?

When a .Net service crashes, does the ServiceBase.OnStop method get called? Will the service be marked as stopped regardless of whether or not the OnStop method is called? ...

Does a dotnet crashing service terminate its own threads?

I have a windows service written in dotNet. There is a worker service that spawns worker threads using various Delegate.BeginInvokes. When the service crashes are those threads going to be cleaned up automatically? And if so, when? ...

Is there a way to debug an already running application compiled in release mode?

I have a dotnet windows service that's currently hung, but running. Is there anyway to attach a debugger to it, despite the lack of symbols; and that it's already running? ...

When installing my windows service, how can I programatically make it use a specific domain account

Hi, I have a windows service that runs fine, but I have to have it run under a special user account. Currently I go into services and change the logon as section, but for deployment this has to be done more professionally. Is there a way for me to have it logon as a custom user account programatically, or during the installation proce...

Windows service, can't access app.config from within my Installer's constructor

Hi, I want to store the username/password information of my windows service 'logon as' user in the app.config. So in my Installer, I am trying to grab the username/password from app.config and set the property but I am getting an error when trying to install the service. It works fine if I hard code the username/password, and fails wh...

Should I put my timer to sleep when my main method is running in a windows service

Hi, In my .net windows service, when my timer elapses and my main method is called, is it best practice to put the timer in sleep mode? This is in case my main method runs for too long, and the timer elapses before the previous calls main method finishes its execution. ...

Windows event scheduler custom service

I need to create a Windows service that works just like the task scheduler in that I can configure what time it runs and it basically just calls a .NET class at that scheduled time (recurring). What is the recommended way to do this? Also, any information on installing/removing that service would be appreciated! Update: Using the task s...

Windows UPS (Uninterruptible Power Supply) service - turn off UPS?

I'm using the UPS service to monitor the state of my UPS from an application -- the key at HKLM\SYSTEM\CCS\Services\UPS\Status has all the information you can get from the Power control panel. BUT -- I'd like to be able to tell the UPS to shut down from my app as well. I know that the service can tell the UPS to shut down -- for instan...

Unable to Connect to SQL Server 2005 Db From Vista x64 Windows Service

I'm trying to connect to a remote SQL Server 2005 db from a .NET Windows service running in Vista Home Premium x64. I can access the remote db from a console app with no problem. I can connect to a local db from the Windows service with no problem. I was able to connect from a service from XP with no problem. There's no firewall or anti-...

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)? ...

System.Drawing in Windows or ASP.NET services

According to MSDN, it is not a particularly good idea to use classes within the System.Drawing namespace in a Windows Service or ASP.NET Service. Now I am developing a class library which might need to access this particular namespace (for measuring fonts) but it cannot be guaranteed that the host process is not a service. Now there is ...

Installing and running a .NET Windows service at a web host

I already asked this question at the JOS-.NET board but Joel is closing that board down so here it is again: Do web hosting providers allow you to install Windows Services? I want to play around with some automation stuff, which I can currently do fine from my own dev pc, but I would like to start opening this stuff up to the public. Ho...

Delphi Windows Services command line arguments

I have a Deplhi based Windows Service that, on installation, parses some command line arguments. I want those arguments to be added to the services command line (ImagePath value on the registry) so that the service is always started with them. How can I accomplish this? I want the regedit look like this: at registry key HKEY_LOCAL_MACH...

In-Process WMI Provider for a Windows Service in .NET

How do you write an in-process WMI provider as part of Windows Service written in .NET? I've written a provider that uses the de-coupled hosting model as a standalone application, but can't figure out how to get a Windows Service that uses the Hosting Model = ManagementHostingModel.NetworkService to work. This is the kind of provider I...

How can I run GUI application without login window session?

My goal is logout current session, then delete the running local user profile. And I have a service to delete the profile already. My problem is, the user has no idea about the background service and who may power off the machine or login again too soon. The idea is that the service will show some popup, and it will not display "Welco...

.NET Windows Service with timer stops responding

I have a windows service written in c#. It has a timer inside, which fires some functions on a regular basis. So the skeleton of my service: public partial class ArchiveService : ServiceBase { Timer tickTack; int interval = 10; ... protected override void OnStart(string[] args) { tickTack = new Timer(1000 * ...

How to make a call to my WCF service asynchronous?

Hi, I have a WCF service that I call from a windows service. The WCF service runs a SSIS package, and that package can take a while to complete and I don't want my windows service to have to wait around for it to finish. How can I make my WCF service call asynchronous? (or is it asynchronous by default?) ...

What account is my service running as?

How do I determine what account a service is running as from within the service itself. ...