windows-services

How can I avoid file locks when updating a windows service?

I have a service that gets updated automatically by another service. The updating service downloads the latest version, shuts down the service (waiting for the stopped status), copies in new files, and starts it back up again. Lately, though, it's getting an access denied error when trying to copy the executable file. This is similar to ...

How to host a console application on Windows Server 2003?

I have to host a console program which hosts an application used by Asp.Net 4.0 and should always be running. What is the best way to host it on the server? I can run the console application from commandline but it can be closed accidently. Windows Service is not an option as we don't have the source code for the Console App. ...

Adding to windows 7 startup services -- is RunServices still valid?

Hi All, I've written a program which I would like to run as a windows 7 service that runs before user logon. Since the program has an installation wizard, it needs to be added to the startup programmatically. I've tried using the HKLM\Software\Microsoft\Windows\CurrentVersion\RunSerivces registry location, but I haven't had any succes...

using FileSystemWatcher to fire event, then delete the newly created file?

I have a windows service using a FileSystemWatcher to monitor a folder, print added images, then delete the image after printing. private void bw_DoWork(object sender, DoWorkEventArgs e) { FileSystemWatcher Watcher = new FileSystemWatcher(); Watcher.Path = @"C:\Images"; Watcher.Created += new...

WCF service hosted in Topshelf takes long time to shut down

I'm using Topshelf to host a WCF Service as a Windows Service. Even when just running on the console, it takes an exceptionally long time to shut down after I send it a Ctrl-C, and this is mirrored when running as a service. On my local machine, it takes 1ms to call svcHost.Close(new TimeSpan(0)), but 10240ms between the end of my Stop...

Showing HTML Help (chm) from interactive service on XP

I have a C++ App than can optionally run as Windows Service on XP and interacts with the Desktop (yes, I know it's bad practice but it's been around for a long time!) Retrofitting html help to it I've discovered HtmlHelp() doesn't work from a service. I've tried running hh.exe using CreateProcess() and ShellExecute() with no success. On...

C# architecture for long-lived data collecting server apps

We are about to start a new project for a server application, for the purpose of collecting data from several data sources and storing it in a database. For a quick test, we created a WinForms app which uses the core functionality from a custom library, and now have to start migrating it towards the final product. From what we've done ...

Changing Default Installation Folder of Visual Studio 2005 Setup

I have created a windows service using Visual Studio 2005. I have created a setup project that would install my application. Now, the default installation folder is always c:\program files\Default Company Name\XXXX. Where can I change this to be something else on startup. Basically, I want the Default Company Name to be removed. Thanks...

Which user permission does a service need to start/stop other services?

I've wrote a service that should start/stop other services. This is the code I'm using: ServiceController sc = new ServiceController("servicename"); if(sc.Status != ServiceControllerStatus.Running) { sc.Start(); } This is the callstack of the exception. (Sorry, but the message is localized in german, but that's not relevant for un...

debugging a crash (c++)

Hi, I am having a service which calls a C++ COM dll. The C++ COM dll causes some problem and the service crashes. I couldn't figure it at what point the service crash. I used debugdiag. But it is not putting any crash dump. Kindly let me know how I can debug a application crash. Or direct me to some good tutorials and tools. Many tha...

How to get the status header for a website programmatically

Hi All, I am writing a win32 service in Delphi (should be able to translate any other code if you don't know delphi) that needs to fetch the status of a website. I know how to do this in .NET but am not sure with normal windows based programming. So, I need to query a website and return the Status Code 200, 301 ect. My plan is then to p...

Windows Service: OnPowerEvent doesn't fire

I want to create a Windows Service that tracks if the A/C power adapter is plugged in or not. For that, I am trying to build Windows Service as below: using System; using System.ServiceProcess; namespace PowerAlert { partial class PowerAlert : ServiceBase { public PowerAlert() { InitializeComponent(); } ...

help with creating windows server

Hi, i'm ASP.NET programmer and have no experience in creating windows services. Service i need to create should send emails to our customers each specified period of time. This service should solve issue when hundreds of emails are sent at the same time and block SMTP service on the server while there are many periods of time when SMTP i...

get the number of logged user on system from within a service

I want to know from within a Windows Service (Local System Account) the number of logged in user on the system, i've implemented this method on my windows Service : protected override void OnSessionChange(SessionChangeDescription changeDescription) { base.OnSessionChange(changeDescription); switch (changeDescripti...

Permanently running executable

Hi all, I created a winform (monitoring) application using VS 2005 (c#), and now, I have a problem when this application crashes for some reason, I have to be sure that it will be restarted automatically. How can I resolve this? (maybe by using windows services application?) Thanks ...

A simple tool to monitor and trace my app

Hi, I have developed an app that runs as a windows service and regularly does a few tasks like synchronizing data sources and generating some statistics. I want to: 1) Get sms when the service stops for any reason. I don't want to deploy a fully fledged infrastructure monitoring system (like nagios). 2) Other people in my team (and p...

Need Help-Windows service or other

Hi, I have to develop a application in .net technology which calls an external service which returns some data which will be stored on server. Now this application should run weekly or monthly basis and will also log the success or failure of bath. For logging i dont have to use databse. Please suggest. ...

windows service causes root certificate update on system with no internet access

So I have a C# windows service that on some systems where there is no internet access won't start. It tries to start, but times out before the service is started. I'm unable to reproduce the issue in any development environment, but have seen it several times on other systems(usually w2k3). When I put my service into a debug mode th...

change windows service password

I am having problems getting the code to change the password of a service of windows provided. Is there an easy way to do this. i got this link but it seems to be incomplete link text here they have not declared SC_MANAGER_ALL_ACCESS, m_pServiceHandle any suggestions?? thanks ...

How does one find out if a Windows service is installed using (preferably) only batch?

I need to check if a Windows service is installed from a batch file. I can dip into something other than batch if I need to, but I would prefer not to. Is there any way to do this? ...